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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
nate_ak
Contributor III
Contributor III

KPI For Aggregation of Measure by Month?

I'm having trouble coming up with the necessary code needed for a KPI chart. I currently have two working Master Items that I'm using in a simple table - a dimension for Year Months in the max available year and a measure for number of accounts opened each Year Month. Here's the code for each.

Year Month: 

=if(left([Year Month],4) = $(vMaxYearApp), [Year Month])

Opened: 

=count(if([OP Account Open Date] >= [First Of Month], [OP Account ID]))

 

And here's an example of the results in the table

table.PNG

I'd like a single measure that combines the logic from my two master items and properly aggregates to the total for all months (circled in the image). I also need it to filter properly when a user chooses specific years and/or one or more Year Month values from a filter pane. 

My thought is that the aggr() function may come in handy here? I'm still a bit new to Qlik and that function's logic though, so I'm not sure. 

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

This should work (I think) if you have an Year field created in the script

=Count({<Year = {"$(=Max(Year))"}>} If([OP Account Open Date] >= [First Of Month], [OP Account ID]))

View solution in original post

1 Reply
sunny_talwar
MVP
MVP

This should work (I think) if you have an Year field created in the script

=Count({<Year = {"$(=Max(Year))"}>} If([OP Account Open Date] >= [First Of Month], [OP Account ID]))