Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello fellow Qlik-ers,
I got a KPI Box which shows a number for specific selections, e.g. Date. What I want to achieve is a second kpi box, that shows the same KPI but one year before the current selection of the user.
So lets say 2021 KPI is 50 and 2022 its 100.
I want the first Box to display 100, when 2022 is selected and the second box to display 50.
I tried like this to achieve this:
count({1<Date = {">=$(MinSelectedDate)<=$(MaxSelectedDate)"}>}distinct %calllogs_PKEY)
The 2 variables are defined like:
addyears(min(Date), -1) and =addyears(max(Date), -1)
My problem with this is, that "1" ignores every selection, so it isn't possible to filter other stuff than date. The $ Operator seem not to work like I want either.
How can I fix this?
Thanks and Best
Is the datatype the issue? Have you tried surrounding the variables with apostrophes?
@Necator Can you try using 2 Set analysis something like below:
Current Year: Sum({<Year={"$(=Date(Max(OrderDate),'YYYY'))"}>}LineSalesAmount)
Previous Year: Sum({<Year={"$(=Date(Addyears(Max(OrderDate),-1),'YYYY'))"}>}LineSalesAmount)
Let me know if this resolved your issue.
Let me clarify myself, sorry. The formula I posted above works quite well, e.g. user selectes just a couple of months Jan 21 -Mar 21. The Formula will calculate Jan 20- Mar20 just like it should do. But using the "1" doesn't allow for other filters which are not date related to be applied. Lets say the KPI is amount of cars sold in the time frame, if the user selects green as color before he will get only green cars for Jan 21 - Mar 21, but still gets all colored cars for Jan 20 - Mar 20. So it doesn't seem like a APostroph issue nor do I want to limit the users filtering to just using full years.
@Necator It would be easier to resolve if you posted your app here