Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am new to qlik and am having some trouble with a set analysis expression im trying to handle.
I am trying to calculate the diff of a measure between the max date in the selection and its predecessor.
date_num = integer value of my date, increasing
report name = report selection
A region filter also applies
I would like something as follows however this doesnt work when a single date is selected.
count({<date_num={$(=max(date_num))}>}ReportName) - count({<date_num={$(=max(date_num, 2))}>}ReportName)
I would like to keep the other two filters to work as normal (reportname and region)
maybe this:
=date( max( {< date_num = E( date_num ) * {"<$(=Max(date_num))"} >} date_num ) )
it should works when a single date has been selected giving you the same value as Max(date_num,2).
I hope it can helps.
Best Regards
No, it won't produce the same issue because it overwrites the set selection. Therefore, the following should work:
count({<date_num={$(=max(date_num))}>}ReportName) -
count({<date_num={$(=max(date_num)-1)},
ReportName=p(ReportName), Region=p(Region)>}ReportName)
in regard to the above mentioned fact of the existing date_num.
- Marcus
Hi thank you for your input.
This approach worked for me, with the addition of {1} in the subtraction.
count({<date_num={$(=max(date_num))}>}ReportName) - count({1<date_num={$(=max(date_num)-2)}, ReportName=p(ReportName), Region=p(Region)>}ReportName)