Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tinkerz1
Creator II
Creator II

Default state in aggr when in an alternate state

Hi,

I am trying to build a dimension from aggr statement when in an alternate state.

my expression is

if(getselectedcount(myfield)>1,

if(wildmatch(fieldB,'*123*'),count distinct(ID2),count distinct(ID))

,count distinct(ID))

The idea is when myfield has more that one selection use a dimension that is the original list.

so the dimension would be:

if(getselectedcount(myfield)>1, aggr({$},myfield,myfield),myfield)

But I am having trouble switching to the original series when in an alternate state.

Thanks.

11 Replies
tinkerz1
Creator II
Creator II
Author

My solution so far is:

if(getselectedcount(Company)>1,
sum(distinct {$<Company = Company + {"*All"}>}DATA1),
Sum(DATA1))

This works and I have now hidden D-All with wildmatch, so sorry for posting this, I can just align my data source to use this formula

tresesco
MVP
MVP

It's nice that you have got the solution. However, generally this should be handled by Generic keys which seems to be more viable.