Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I am trying to count IDs based on a selection of another Field where year takes the possible values of Year2
I do it like this but it doesn't work
count({<Year=Year2>}ID)
Thanks
If you want to take the possible values instead of selected values, try
count({<Year= p(Year2) >} ID)
and maybe clear selections in Year2 field, if this may render to an incompatible set:
count({<Year=p(Year2), Year2= >} ID)
Or:
count({<Year={$(=Concat(distinct Year2, ','))}>}ID)
Note: swuelh's solution is better, use that if it works with your real requirements. I put this option just as a piece of knowledge.
Count({$ <ID={"=Year=Year2"}>} ID)
Count({<ID=p({<Year=$::Year2>} ID)>} ID)
thank you for your answer, but you have to be careful with concat(), if the field contains many values this will deteriorate your app, even corrpt it
Try using GetFieldSelections function and use the results in a p() function in set Analysis.
Thank you guys for your answers, basically I used it to do alternate state analysis in qliksense since it doesn't support the feature, so for example
perimeter1:
sum({<year=p(year1)>} Sales)
perimeter2:
sum({<year=p(year2)>} Sales)
And it works!
so it answers two questions in one,
this is great. just used this to get simpler set analysis syntax on an unrelated issue.