Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need Help Urgent -- Aggr function

Hi All,

     I have an issue with the Aggr function.. I have a stacked bar chart in which I have written the expressions using set analysis.. When I do the filterations the Stacked bar chart does not effect.. Inorder to make this changes with the filterations I wrote the same expressions using IF condition.The cout shows more now.. I have added aggr function  to the IF condition.. i.e Aggr(if(***,Sales) but now the chart does  not show up the values untill some specific selections are made.. Now the count matches but my question is why the count disappears if I clear the selections.. Let sayd I have made selctions on some fields like month,Project ID and Status..

Anyhelp would be greatly appreciated..

Thanks

8 Replies
Jason_Michaelides
Partner - Master II
Partner - Master II

Can you post your app to give a clearer picture?

Not applicable
Author

Sorry due to security Issues i could not provide the application.. I can understand its difficult to understand the situation with out some sample data but could not provide the same., just wanted to know why the aggr function is behaving like that...

Jason_Michaelides
Partner - Master II
Partner - Master II

At least post your expression...

Not applicable
Author

using set analysis :

sum({< Class = {'XYZ'} , Status = {' ABC'}  >} Sales)

IF condition

sum(if(Class = 'XYZ',Status = 'ABC',Sales)) but in both the cases the count is differeent.. SO I have aggregated the IF condition by ID.. so the count was matching when I tried validating the data by seleting a vlaue in ID field.. but when i clear the selection the count in IF is coming as null.. why this happens?

Jason_Michaelides
Partner - Master II
Partner - Master II

Difficult to say without seeing it in situ.  What are the dimensions of the chart?  Can you post the data model?

swuehl
MVP
MVP

If you are using something like

if(Class = 'XYZ',Status = 'ABC',Sales)

I read this as

if Class equals 'XYZ' then Status = 'ABC', else Sales

'then Status = 'ABC' doesn't make sense to me here, and you can't assign Status field a new value like that. It's another comparison operator, but you don't create another path using a second if() function, so I am not sure what you intend with this. I believe the then-path will just return 0 or -1.

You probably want to use a logical operator and two comparisons:

=sum(if( Class = 'XYZ' and Status = 'ABC', Sales))

right?

Not applicable
Author

Sorry I have written it wrongly in the IF condition sum(if(Class='XYZ' and Satus = 'ABC',Sale))..

This is correct the same functianlity I am trying to implement through the IF condition but failing to do the same

Not applicable
Author

Small corretection in the IF expression.. posted the same again.. the dimesion is CLass