Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey there,
I have a master calender and it is already possbile to select multiple months.
I also get the values with the GetFieldSelections() function. (output e.g: Jan,Feb,Mrz...)
But when I want to calculate different measues it is only working with one selected month.
My expression for calculating Retail Sales:
if(isNull(MasterMonth), SUM({<Year_RS=MasterYear>}Retail_Sales),
SUM({<Year_RS=MasterYear,Month_RS=MasterMonth>}Retail_Sales))
Its working very well if only one month is selected but if there are multiple months the result is always the total of the selected year.
I think its because of the isnull(MasterMonth) but I don't know how to solve it
Any ideas?
Oh yes, you can use variables in Qlik Sense. Exactly the same way as in QlikView. They just haven't been exposed in the dialogues (yet).
HIC
After some google, thanks for this hint
It is possible to create variables with the script editor. Thanks again!
Actually the measure should do the following during the calculation:
If the user selects only one oder multiple years the measure should logically calculate for the whole year/s.
If the user selects a year and one or multiple months the measure should calculate it only for the months.
It is also possible that the user selects multiple years and one or multiple months.
For example:
#1: MasterYear: 2014
#2: MasterYear: 2014, 2013
#3: MasterYear: 2014 MasterMonth: Jan, Sept
#3: MasterYear: 2012, 2013 MasterMonth: Jan
#4: MasterYear: 2014,2015 MasterMonth: Jan, Feb, Mrz...
I think it is working with this workaround:
if(sum(DISTINCT (MasterMonth)) = 78,SUM({<Year_RS=MasterYear>}Retail_Sales),
SUM({<Year_RS=MasterYear,Month_RS=MasterMonth>}Retail_Sales))
But I'm not entirely sure.
Thanks for your support!
We modified our data model to a canonical date like here: Canonical Date
After that, there were no more problems.