cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Masoud9
Level: Powered On

Conditional navigate with CountIf variable

Hi everyone!

 

I have an app linked to a sharepoint list. I have a screen which I use a dashboard, in this screen I have some indicators that  are calculated using the CountIf formula. I would like to set a variable based on this numbers, when the sum of them is 0, I would like my gallery to change its navigation conditions (attached photo of the dashboard).

 

The CountIf formula I am using is the following (this formula works perfectly):

 

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES")

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO")

 

and so on...

 

Then, I would like something like this (but this formula does not work):

 

Set(Variable1;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES"))

Set(Variable2;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO"))

 

And then, change the OnSelect properties of my gallery using something like this:

 

If(Variable1+Variable2+Variable3=0;Navigate(Screen1);Navigate(Screen2))

 

I need help with all those formulas. Is possible to achieve what I want?

 

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Conditional navigate with CountIf variable

Hi @Masoud9 ,

Do you mean that :

1)these two formulas work well

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES")

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO")

2)these two formulas do not work

Set(Variable1;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES"))

Set(Variable2;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO"))         ?

 

Could you tell me how do you set variable1 and variable2?

Since Set function is a behaviour function,  you can use it only within a behavior formula.

For example, set a button's OnSelect.

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
shailendra74
Level 8

Re: Conditional navigate with CountIf variable

Hi @Masoud9 

 

Not sure why you want separate variable (var 1, var 2) when you are summing up these variables to decide on which screen to nagivate.

 

You can have 

Set(Variable1;CountIf(SPList;Colum1 = ThisItem.Result &&  ('Colum2'= "YES" || 'Colum2'= "NO" )))

 

Further the count of below will always be > 0 :

 

Set(Variable1;CountIf(SPList;Colum1 = ThisItem.Result) // if you want to check specific value you should hardcode Colum1 = "VALUE"

 

and so the variable1 depend on colum2. So the column 2 value should be other than YES/NO to get Variable1 = 0.

 

 

Thanks.

 

 

 

Community Support Team
Community Support Team

Re: Conditional navigate with CountIf variable

Hi @Masoud9 ,

Do you mean that :

1)these two formulas work well

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES")

CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO")

2)these two formulas do not work

Set(Variable1;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "YES"))

Set(Variable2;CountIf(SPList;Colum1 = ThisItem.Result && 'Colum2'= "NO"))         ?

 

Could you tell me how do you set variable1 and variable2?

Since Set function is a behaviour function,  you can use it only within a behavior formula.

For example, set a button's OnSelect.

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Masoud9
Level: Powered On

Re: Conditional navigate with CountIf variable

Thanks @v-yutliu-msft  and @shailendra74 , I didn't take into account that "set" is a behaviour formula, that's why it didn't work. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 53 members 4,899 guests
Please welcome our newest community members: