Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
EliGohar
Partner - Creator III
Partner - Creator III

Limit dimension for last 5 values

Hi Qlikers,

I have the following chart that presents number of success/failures by build(Version)

EliGohar_0-1636617207522.png

My goal is to show data only for the last 5 versions. 
Can you please help me with how to acheive it?

Eli.

 

1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

So the expected values are 

6.2.32247
6.2.32263
6.2.32273
6.2.32287
6.2.32313

 

I have used below script. Please check if that works for you.

Table:
Load BuildNumber,PASSED,FAILED, RowNo() as NumBuildNumber Inline [
BuildNumber,PASSED,FAILED
6.2.32030, 89%, 11%
6.2.32050, 75%, 25%
6.2.32051, 71%, 29%
6.2.32053, 100%, 0%
6.2.32055, 98%, 2%
6.2.32056, 47%, 53%
6.2.32061, 100%, 0%
6.2.32074, 45%, 55%
6.2.32077, 93%, 7%
6.2.32078, 98%, 2%
6.2.32085, 100%, 0%
6.2.32107, 98%, 2%
6.2.32108, 92%, 8%
6.2.32113, 54%, 46%
6.2.32115, 98%, 2%
6.2.32133, 100%, 0%
6.2.32136, 95%, 5%
6.2.32138, 47%, 53%
6.2.32141, 100%, 0%
6.2.32149, 97%, 3%
6.2.32152, 91%, 9%
6.2.32155, 100%, 0%
6.2.32159, 98%, 2%
6.2.32164, 98%, 2%
6.2.32167, 100%, 0%
6.2.32172, 94%, 6%
6.2.32187, 98%, 2%
6.2.32195, 98%, 2%
6.2.32203, 98%, 2%
6.2.32211, 100%, 0%
6.2.32216, 98%, 2%
6.2.32218, 100%, 0%
6.2.32247, 100%, 0%
6.2.32263, 100%, 0%
6.2.32273, 100%, 0%
6.2.32287, 100%, 0%
6.2.32313, 94%, 6%

];

Exit Script;

 

Output :

AshutoshBhumkar_0-1636624898558.png

Measure for Failed : Sum({<NumBuildNumber = {">=$(=Max(NumBuildNumber)-5)"}>}FAILED)

Measure for Passed : Sum({<NumBuildNumber = {">=$(=Max(NumBuildNumber)-5)"}>}PASSED)

 

Note : You need to make sure the sorting order of the data.

 

Thanks,

Ashutosh

View solution in original post

4 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

How about giving Rank to every version and taking last 5 ranks.

Could you please provide any sample data ?

 

Thanks,

Ashutosh

EliGohar
Partner - Creator III
Partner - Creator III
Author

Attached in xlsx format.

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

So the expected values are 

6.2.32247
6.2.32263
6.2.32273
6.2.32287
6.2.32313

 

I have used below script. Please check if that works for you.

Table:
Load BuildNumber,PASSED,FAILED, RowNo() as NumBuildNumber Inline [
BuildNumber,PASSED,FAILED
6.2.32030, 89%, 11%
6.2.32050, 75%, 25%
6.2.32051, 71%, 29%
6.2.32053, 100%, 0%
6.2.32055, 98%, 2%
6.2.32056, 47%, 53%
6.2.32061, 100%, 0%
6.2.32074, 45%, 55%
6.2.32077, 93%, 7%
6.2.32078, 98%, 2%
6.2.32085, 100%, 0%
6.2.32107, 98%, 2%
6.2.32108, 92%, 8%
6.2.32113, 54%, 46%
6.2.32115, 98%, 2%
6.2.32133, 100%, 0%
6.2.32136, 95%, 5%
6.2.32138, 47%, 53%
6.2.32141, 100%, 0%
6.2.32149, 97%, 3%
6.2.32152, 91%, 9%
6.2.32155, 100%, 0%
6.2.32159, 98%, 2%
6.2.32164, 98%, 2%
6.2.32167, 100%, 0%
6.2.32172, 94%, 6%
6.2.32187, 98%, 2%
6.2.32195, 98%, 2%
6.2.32203, 98%, 2%
6.2.32211, 100%, 0%
6.2.32216, 98%, 2%
6.2.32218, 100%, 0%
6.2.32247, 100%, 0%
6.2.32263, 100%, 0%
6.2.32273, 100%, 0%
6.2.32287, 100%, 0%
6.2.32313, 94%, 6%

];

Exit Script;

 

Output :

AshutoshBhumkar_0-1636624898558.png

Measure for Failed : Sum({<NumBuildNumber = {">=$(=Max(NumBuildNumber)-5)"}>}FAILED)

Measure for Passed : Sum({<NumBuildNumber = {">=$(=Max(NumBuildNumber)-5)"}>}PASSED)

 

Note : You need to make sure the sorting order of the data.

 

Thanks,

Ashutosh

EliGohar
Partner - Creator III
Partner - Creator III
Author

Thanks @AshutoshBhumkar, nice solution!