Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, Qlik community!
I have a line chart with 3 measures, the last measure is comparison with Year Before. Currently the Year Before line shows only the year before direct purchases for 2022 and as you cans see the red line in 2023 is null, which should show 2022 data. The years can be chosen from a date filter.
The calculation behind this is complex and the mistake might be in either the dimension or the measure expression. This is the dimensions expression: =If($(vL.UI.time.Field)>=vL.time.From,Date([#$(vL.UI.time.Field)], 'DD MMM'),Date([#$(vL.UI.time.Field)]+$(vL.time.ToShift),'DD MMM'))
Measure expression:
Hi
May have a look to this post
The trick is to create a pivot calendar in the script between your calendar table and fact table :
Load script to generate it from Facts :
Pivot:
Load distinct Date_ID as Date_ID,
Date_ID as Date_Cal,
'P' as TypeDate
resident Sales;
Load distinct Date_ID-364 as Date_ID,
Date_ID as Date_Cal,
'SameDay' as TypeDate
resident Sales;
then adapt your mesure for previous year with set analysis :
Current Year : Sum({$<TypeDate={'P'}>}Sales)
Same Day previous year : Sum({$<TypeDate={'SameDay'}>}Sales)
Hope it helps
Thank you for your suggestion, but it doesn't help for this issue