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

How to show only last 5 days of data in Qlik Sense Pivot Table

Hi, I have a pivot table that looks like the one below in Qlik Sense.

mnev0003_1-1643320378948.png

'Where first seen' and 'Date' are dimensions. The 'T/S', 'T/C', 'C', 'D/C' and 'D/S' are measured values that use the count function. I would like to show only the last 5 days of data in the table without the user having to touch anything.

Only loading 5 days of data in the script isn't an option as we have multiple pivot tables showing different lengths of time on the same sheet (eg. 5 days of data, 10 days of data, 30 days of data). 

Can anyone please help with this ? Thanks a lot! 

 

 

Labels (2)
3 Replies
Vegar
MVP
MVP

I notice you have date as a dimension. You could try to replace it with an calculated dimension. Define the dimension  like this:

if([Date]>max(total [Date])-5, [Date], Null())

Alternatively you can add a set modifier to all your expressions limiting the Date span of the calculation. 

mnev0003
Contributor
Contributor
Author

Thanks a lot. The calculated dimension works but it requires you to select the specific dates in the filter. This means all the tables are then filtered for these dates. Is there a way to have different calculated dimensions for each table? 

mnev0003_1-1643343571856.png

 

 

Channa
Specialist III
Specialist III

try

create two variables

vFromDate=Max(date)-5

vToDate=Max(Date)

 

try this expression in measure

=Sum({<Date={">=$(vFromDate)<=$(vToDate)"}>} Value)

Channa