Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kovacs_Balazs98
Contributor II
Contributor II

Data visualization

Hi there,

 

I am currently trying to figure out a way to display data on a visualization from previous year. My example is that I want to show on a KPI the retired workers from last year, but always from last year .  Also I dont want to tinker with the loading, is there a way to solve this in the measure formatting?

Here is a dummy table:

Name    Startdate          Enddate          Retired

A             2015.10.12       2019.08.09        Yes

B            2016.11.03       2020.09.10         Yes

C            2017.05.12       2025.09.07        No

D           2018.07.25       2019.03.04        Yes

 

So right now this should be showing 1 person (current year 2021), but last year it would show 2 people

 

Thanks in advance for your help.

Labels (2)
1 Solution

Accepted Solutions
Kovacs_Balazs98
Contributor II
Contributor II
Author

Hi!

Thank you for your help, the first measure worked fine but the second one returned 0 value because in the enddate filed the max year was 2025, so it wasnt dynamic. But I created a field which will always bring out the last year (Year(Today())-1. And changed the variable so it brings out data from the the new Field instead of the Enddate field. And so it brought out the correct answers. Thx for help.

Jó.PNG

View solution in original post

4 Replies
Ksrinivasan
Specialist
Specialist

hi,

Ksrinivasan_0-1611219602009.png

 

Ksrinivasan_1-1611219645506.png

result:

Ksrinivasan_2-1611219686411.png

 

ksrinivasan

Kovacs_Balazs98
Contributor II
Contributor II
Author

Thanks ksrinivasan! But my boss wants to look it as a Kpi, he just wants to see the sum amount like this:

Képkivágás.PNG

Any ideas to this?

 

Ksrinivasan
Specialist
Specialist

hi,

sry for delay

Ksrinivasan_0-1611244490414.png

 

1st measure: Count({$<End_dt = {'$(=vMaxenddt)'}>}([Name ]))

2nd Measure: Count({$<End_dt = {'$(=vMaxenddt-1)'}>}([Name ]))

create variable:

Ksrinivasan_1-1611244607341.png

 

Script

Ret:
LOAD
"Name ",
"Startdate ",
Year("Enddate ") as End_dt,
Retired

 

ksrinivasan

Kovacs_Balazs98
Contributor II
Contributor II
Author

Hi!

Thank you for your help, the first measure worked fine but the second one returned 0 value because in the enddate filed the max year was 2025, so it wasnt dynamic. But I created a field which will always bring out the last year (Year(Today())-1. And changed the variable so it brings out data from the the new Field instead of the Enddate field. And so it brought out the correct answers. Thx for help.

Jó.PNG