Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I have the below dimension to get the sales of last 12 months in my Chart. But, this doesn't work somehow(Always gives 0). Can you please point out the error here.
sum(TOTAL<Artikel_Name> aggr(sum({<Month >= AddMonths(Today(), -12) >} Sales),Artikel_Name))
Thanks
Sai.
Your set-expression should be:
Month = {"<= $(=Month(Today())) > $(=Month(AddMonths(Today(), -12)))"}
Provided that your Month-column is in the same format as Month(Today()) gives back.
Hi Niclas,
if(column(1)>0,
sum(TOTAL<Artikel_Name> aggr(sum({<MonatNum = {"<= $(=Month(Today())) > $(=Month(AddMonths(Today(), -12)))"} Sales),Artikel_Name))
)
You, mean something like this? But, this still gives me 0.
It’s hard to know what goes wrong without seeing your data. Can you upload the Qvw so I can take a look?
Från: Pakalapati Sai Kumar <qcwebmaster@qlikview.com>
Skickat: den 30 juli 2018 10:44
Till: Niclas Anderström <niclas.anderstrom@mindcamp.se>
Ämne: Re: - Total of last 12 Months
You want last 12 months? so why are you looking at just the month field.... do you have a monthyear field in your data? if you do... it might make sense to use that to get last 12 months...
Sum({<MonthYear = {"$(='>' & Date(MonthStart(Today(), -12), 'MMM-YYYY') & '<=' & Date(MonthStart(Today()), 'MMM-YYYY'))"}>} TOTAL<Artikel_Name> Aggr(Sum({<MonthYear = {"$(='>' & Date(MonthStart(Today(), -12), 'MMM-YYYY') & '<=' & Date(MonthStart(Today()), 'MMM-YYYY'))"}>} Sales), Artikel_Name))
Where MonthYear field is created like this in the script
Date(MonthStart(TempDate), 'MMM-YYYY') as MonthYear