Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi dear members of the Qlik community,
could you please help me to troubleshoot the issue with a dimension built using master measures?
The first master measure represents month-to-date sum of sales (MTD), taken from the alternate state 1 (set by a filter).
Sum({[1]<Order_date={">=$(=Date(MonthStart(Max(Order_date)), 'YYYY-MM-DD'))<=$(=Max(Order_date))"}>} sales)
The second measure represents the sum of sales for the previous 3 months before the current month taken from the alternate state 1 (PM-3):
Sum({[1]<Order_date={">=$(=Date(MonthStart(AddMonths(Max(Order_date), -3)), 'YYYY-MM-DD'))<=$(=Date(MonthEnd(AddMonths(Max(Order_date), -1)), 'YYYY-MM-DD'))"}>} sales)
My plan was to build a dimension with a flag to show the new customers:
IF(([MTD]>0 and [PM-3] = 0), 'J', 'N')
The measures are working as expected, when I put them in a table with default state. But the dimension outputs only 'N', which is not correct.
Could you please tell, what do I miss here? Why is not this flag working?
If flag is a dimension maybe you need to add an Aggr() to calculate it by each of the kundennr, not globally, like:
Aggr(IF(([MTD]>0 and [PM-3] = 0), 'J', 'N'), kundennr)
Hi, have you tried to set a table with both master measures and the flag expression? Is there any with MTD>0 and PM-3=0 and still the 3rd expression shows N?
Hi Rubenmarin,
thanks for reply. Yes, when I create a table with both master measures and the flag, I see a plenty of examples when MTD >0 and PM-3 = 0, which are marked as 'N'.
If flag is a dimension maybe you need to add an Aggr() to calculate it by each of the kundennr, not globally, like:
Aggr(IF(([MTD]>0 and [PM-3] = 0), 'J', 'N'), kundennr)
It works now! I didn't even think about aggregation in this case. Thank you very much!