Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
JohnDoe
Partner - Contributor
Partner - Contributor

QS Show last value from a unrelated date

Hello everyone.

I have a Qlik Sense App that must display a few indicators bringing the user the possibility of narrowing data across date dimensions as Year and Month (forget about days).

This app counts with a Master Calendar that is taking from the oldest to the newest date from the Date field from Facts table.

Each indicator has a different source, this means that usually indicators could not share same date ranges, like in the example below:

KPIDate (DD/MM/YYYY)Value
119/12/20193
120/12/20194
114/02/20205
209/11/20196
209/03/20207
201/04/20208

 

The main mission is to display last value from the last date available of each indicator, even though the selected date could be more recent than available date.

The desirable output would become like this examples:

1st desirable case, selected dates: April 2020 or year 2020

KPIDate (DD/MM/YYYY)Value
114/02/20205
201/04/20208

 

2nd desirable case, selected dates: December 2019 or year 2019

KPIDate (DD/MM/YYYY)Value
120/12/20194
209/11/20196

 

What I wish to avoid is to accumulate data values in the script, I mean to avoid replicate the old value from February to March and April for KPI 1. Copying last recent data in the missing dates on each KPI is an option I want to avoid.

My intended approach is to solve it using expressions, set analysis or flag use on script. I've already played with P() and E() functions without any success.

Fortunately, each indicator can have its own expression, so each KPI could have different set analysis. I'm pretty sure someone else has had the same problem, but I couldn't find on the Community a post related to a similar issue.

Stay healthy, and thank you in beforehand,

Regards,

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

FirstSortedValue({<Date = {"<=$(=Date(Max(Date), 'DD/MM/YYYY'))"}>} Value, -Date)

View solution in original post

3 Replies
sunny_talwar

Try this

FirstSortedValue({<Date = {"<=$(=Date(Max(Date), 'DD/MM/YYYY'))"}>} Value, -Date)
sunny_talwar

I have attached a sample qvf file for you to look at

JohnDoe
Partner - Contributor
Partner - Contributor
Author

This worked f l a w l e s s. Thank you very much!!