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

Show last 10 days in a bar chart

Hi ,

I've been strugling to create an expression to show only the last 10 days on my chart .

this is how my data look like :

id_Date  2014 / S1     and  PDCH  90

              2014 / S2                       80

              2014/ S 3                        85

I wont to show only data of the current day and the 9 previous.

Any ideas Please.

Regards, Ameni

17 Replies
robert_mika
Master III
Master III

Yor Id_Date has only Year/Category how can you calculated date?

If you had numeric value you could use this method

Use a expression with an interval time using set analysis, something like this:

sum({<Id_date={">=$(vStartDate) <=$(vEndDate)"}>}PDCH)

where you declare two variables (in "Variables Overview") like this:

vEndDate = Max(MyDateField);

vStartDate = ($(vEndDate) -10);

Not applicable
Author

actually this is the Year/week_number  from master calender

MK_QSL
MVP
MVP

Provide proper sample data similar to you application.. This would help to work and answer..

Not applicable
Author

this is an exemple of my data where id_Date = Year / Week_number

robert_mika
Master III
Master III

If this is Year/Day how would you extract days?

Do you want to see last 10 values?

Not applicable
Author

Hi,

If id_Date is your dimension and you only want to show top 10 id_Dates, you could use expression:

=If(RowNo() < 11, yourexpression))

edit: 9 id_Dates to 10

Not applicable
Author

I want to show only the data for the last 10 days , is that possible ?

ramoncova06
Specialist III
Specialist III

danieloberbilli
Specialist II
Specialist II

If your data is simple, you could sort the chart by expression and use there your date field with descending order. Then on the Dimension limits tab use Show only First 10 Values