Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
sunny_talwar

Not 100% sure what you trying to do, but may be this:

If(GetSelectedCount(myfield) > 1, Aggr(Only({$} myfield), myfield), myfield)

tinkerz1
Creator II
Creator II
Author

Here is an example of what I am trying to do and have uploaded a qvw.

When more than one company is selected I am trying to append and extra row of data to the table

In this instance the flag 'All' will be used to append the data

=if(GetSelectedCount(Company)>1,
sum(DATA1) and wildmatch(company,'All'),//Having trouble with this line
sum(DATA2))

I hope the example explains it.

Maybe I need a better flag on the data to append.

sunny_talwar

I don't see a qvw attached Neil. Can you reattach it please

tinkerz1
Creator II
Creator II
Author

Here is the attachment, thanks.

sunny_talwar

Are you saying that when you click on D-ALL you would like to see all the companies? (A, B, C, and may be D)

tinkerz1
Creator II
Creator II
Author

I wanted to hide D-All from the Company list box using wildmatch.

Then when the getselected>1 is triggered, append A to a pivot or straight table

sunny_talwar

I think you need a And-Mode selection. This may not work for your situation, but worth taking a look.

AND-Mode

In the mean time I am looking for alternatives

tresesco
MVP
MVP

Is it about hiding the 'D-All' member from the list box, or, adding an extra line in the chart? If you get an extra line in the chart with 'All' - what value do you wish to see against it? Total sum?

tinkerz1
Creator II
Creator II
Author

The problem that I have in the real set of data is that I dont know if A,B or C is to be summed, but I do know that the D-ALL will always be in the chart as long as there are more than 1 selected companies

Please think in terms that A,B,C are totals and D - All is a forecast.

So I will need to SUM A,B or C to make total and have D-All in the same chart.

At the moment the user will not be able to select D-All, it will appear based on getselected count.

Later on I will remove D-All from the list box using not wildmatch *- All*