Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
byrnel0586
Creator
Creator

Aggr(Sum) Function in Alternate States

Hi all,

I have an expression that is currently working for my needs based on what is currently selected. But now I am needing to make a comparison of this expression against other selections using alternate states - which I have defined as "Group1" & "Group2". I have seen some simple expression examples, but my calculation appears more complex and I am unsure how to begin modifying it for use in alternate states.

Any help is much appreciated. Thank you.

=if(num(ReportDate) < '43312', AGGR(IF(num#(SUM(NUMERATOR)/SUM(DENOMINATOR))>=num#(PtileBeg) and num#(SUM(NUMERATOR)/SUM(DENOMINATOR))<= num#(PtileEnd)
,
Star),Star,MeasureID),
AGGR(IF(num#(round(SUM(NUMERATOR)/SUM(DENOMINATOR),0.01))>=num#(PtileBeg) and num#(round(SUM(NUMERATOR)/SUM(DENOMINATOR),0.01))<= num#(PtileEnd)
,
Star),Star,MeasureID))

1 Solution

Accepted Solutions
sunny_talwar

There was problem with the parenthesis... try now

View solution in original post

7 Replies
sunny_talwar

May be this

=If(Num(Only({[Group1]} ReportDate)) < '43312',

Only({[Group1]} Aggr(

If(Num#(Sum({[Group1]} NUMERATOR)/Sum({[Group1]} DENOMINATOR)) >= Num#(Only({[Group1]} PtileBeg)) and Num#(Sum({[Group1]} NUMERATOR)/Sum({[Group1]} DENOMINATOR)) <= Num#(Only({[Group1]} PtileEnd)), Only({[Group1]} Star)), Star, MeasureID),
Only({[Group1]} Aggr(If(Num#(Round(Sum({[Group1]}NUMERATOR)/Sum({[Group1]}DENOMINATOR), 0.01)) >= Num#(Only({[Group1]} PtileBeg)) and Num#(Round(Sum({[Group1]}NUMERATOR)/Sum({[Group1]}DENOMINATOR),0.01)) <= Num#(Only({[Group1]} PtileEnd)), Only({[Group1]} Star)), Star, MeasureID))

byrnel0586
Creator
Creator
Author

Thanks, Sunny. I'm sure this would work, however, I am seeing the no data to display message. I am new to using alternate states.  I am wanting to see this calculation in a chart based on a Physician ID # that I have selected and have assigned to the alternate state Group1. Do I need to assign the fields within the calculation to Group1 also, even if they will not be a selection?

My other thought would be to define the calculation as a field in the script first and then use it for the alternate state. Your help is appreciated as always!

byrnel0586
Creator
Creator
Author

Actually, aggr isn't able to be used in the script, so defining as a field there doesn't not seem possible

sunny_talwar

Would you be able to share a sample to show the issue?

byrnel0586
Creator
Creator
Author

Sure, thank you so much.

sunny_talwar

There was problem with the parenthesis... try now

byrnel0586
Creator
Creator
Author

It is working. Thank you again!!