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: 
geertdeman
Contributor III
Contributor III

Sum value for max date

I need the total  value for each company for the maximum month (and also for maximum month -1).  My calculation is working as long there is data for all months but once there is a month missing (in the example november is missing for company A)  the calculation of that value is wrong.  This is the calculation I used for Sum Cur Month: sum({<YearMonth={"$(=Date(max(Date#(YearMonth, 'MMM-YYYY')),'MMM-YYYY'))"}>}
Counter). 

The calculation that I used for column current month is working like expected: Date(max(Date#(YearMonth, 'MMM-YYYY')),'MMM-YYYY')

Why is that sum function not using the maximum month value for that company as filter, it seems like it is using november 2018 for all companies

 

 

sum example.jpg(Photo shows a simplified version of the data, it is also possible to filter on company, period and a couple of other dimensions.  Data should be updated with the selected filters)

Labels (1)
13 Replies
sunny_talwar
MVP
MVP

Are you picking one of the two dimensions based on this variable value? $(vAux.Compliance.QPPVFlagValue)
geertdeman
Contributor III
Contributor III
Author

correct
sunny_talwar
MVP
MVP

Then I believe dollar sign expansion should work

$(= '[' & Pick($(vAux.Compliance.QPPVFlagValue),
'REC_COMP_CATEGORY_CHANGED',
'REC_COMP_REGION_GROUPING',
) & ']')
geertdeman
Contributor III
Contributor III
Author

it didn't work the first time, I tried to modify it and changed it back to your solution and it is working now!