Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I created variable vLastyear with this expression: =year(max(Date))-1.
I created a KPI :
sum( {<Year={'$(vLastYear)'}>} margin) and it gives me 0 as an output of the margin when I select Q1-2019 even though it recognized it in the ok statement as sum( {<Year={'2018'}>} margin) when I have data for the year 2018.. why it gives me 0 as an output in qlik sense when the selected period is Q1-2019
Hi,
To be sure, can you share your Data Model please ?
kind regards
The KPI is on the dashboard:
you can see there is 0 when I select the Q1-2019 quarter from the graph
Thanks:
Maybe this one: sum({<Year={'$(vLastYear)'},YearQuarter=>}margin)
and if I want it to calculate the Q1-2018 if I choose Q1-2019?
when I use this expression it calculate all 2018 when I select "q1-2019" for the second KPI and the for the first KPI it calculate just for the Q1-2019.
this is my first KPI: =sum( {$<Year={'$(vMaxYear)'}>} margin)
Then can you try this one: sum({<"Num(YearQuarter)"={"$(=Num(AddYears(YearQuarter,-1)))"}>}margin)
It gives the same output as the first KPI- meaning the margin of the same selected YearQuarter.
It doesn't recognize as a year- see the pic attached.
In addition- I want to write an expression that will calculate the margin of the last year if I choose year and the margin of the same quarter for the last year if I choose YearQuarter ( and so on if I choose Yearmonth) for the same expression ...
Hi,
This one: Sum({<YearQuarter={'$(=Year(YearQuarter)-1 & '-Q' & ceil(month(YearQuarter)/3))'}, Year={'$(=Year(Year-1))'} >}margin)
Please see "New sheet" sheet for details