Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Vonthak
Contributor
Contributor

Create a KPI for last month

Hello all,

I am starting in Qlik and I am still learning how to do the set analysis and using the different functions. 
I need to create a KPI based on this data : 

Vonthak_0-1702999001839.png

I want to be able to show the last month value for both ratios. I created a KPI box and tried different things and searched for answer but couldn't succeed to show the values. Basically, my dashboard should show the value for last month (In this case November) in my KPI box I created, but I should be able to see the past months value if I select another month in my filter pane.  Each month a new line will be added to this data and loaded into Qlik so in January 2024, it should show for december 2023.  I need the solution for one of the ratio since it should be the same solution but with the different fields for the second one. 

Thank you for your help ! 

Labels (2)
3 Replies
Ahidhar
Creator III
Creator III

try this

Sum({<Month={"$(=date(addmonths(max(Month),-1),'MMM-YYYY'))"}>}Ratio1)

Ahidhar_0-1703054675667.png

 

Vonthak
Contributor
Contributor
Author

Hi, 

I tried it however for some reasons it shows me only 0% in my field no matter the filter or even the base value without filter. In qlik, my data is named differently but still the same logic and the data type and format is the same. However, if you look at the picture here, the expression in the lower box returns an hyphen in the middle I don't know if that's a problem. Thank you

Vonthak_1-1703079844718.png

 

 

MatheusC
Specialist
Specialist

@Vonthak 
I believe that for the scenario demonstrated you will have to work with the Hoje() function, but it will have filter limitations.

sum({<Month_FTR={"$(=Data(addmonths(Today(1),-1),'MMM-YYYY'))"}>}[RFR to PCR ratio])
* It will not adapt to the filter, it will always bring the value before today()*

Assuming you have these separate Month and Year fields, you can perform better treatments to create MonthName and use it in your expression.

See the topic below:

https://community.qlik.com/t5/Brasil/Concatenar-numero-com-texto-e-classificar/td-p/972419

Att,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!