Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ilanbaruch
Specialist
Specialist

getfieldselection alternate state

hi all

in my model i have a pivot with 2 alternate state calculations

i want to add to the table calculation condition to only calculate if one of the alternate state dims are selected 

tried it with the below condition :

getselectedcount(Year,[State1]) >0 or getselectedcount(Year,[State2]) >0

but didnt succeed ,  any ideas ?

 

advanced thanks

Labels (1)
1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

Add Distinct

 

Concat({[State1]} Distinct Year,'|')

View solution in original post

4 Replies
jwjackso
Specialist III
Specialist III

If you are trying to determine if only 1 item is selected from the dimension, you can use a combination of Concat  and SubStringCount .

Suppose that your Year dimension only has 2018, 2019, and 2020.  

If nothing was selected, using the following Concat({[State1]}Year,'|') would return 2018|2019|2020.  If 2019 was selected, the statement would return 2019.  If 2019 and 2020 were selected, the statement would return 2019|2020.  Combining the the Concat with SubstringCount, SubstringCount(Concat({[State1]}Year,'|'),'|') = 0 when only 1 year is selected.

Try:

SubstringCount(Concat({[State1]}Year,'|'),'|') = 0 or SubstringCount(Concat({[State2]}Year,'|'),'|') = 0

ilanbaruch
Specialist
Specialist
Author

hi Jwjackso,

when adding : Concat({[State1]}Year,'|')

i receive duplication of the year selected in state 1 , so the SubstringCount retrieves a huge number..

 

 

jwjackso
Specialist III
Specialist III

Add Distinct

 

Concat({[State1]} Distinct Year,'|')

ilanbaruch
Specialist
Specialist
Author

yap. that did the trick.

thank you