Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
zenobendi
Contributor III
Contributor III

How to get a chart show 10 days before today's date?

Hi,

I have a chart and I want it to show the data only for 10 days before today'date. So if today is the 02/18/2019, I want it to show the data for:

02/18/2019 , 02/17/2019 , 02/16/2019 , 02/15/2019 , 02/14/2019 ... until ... 02/09/2019

Is there any calculated dimension I could use?

Thanks

1 Solution

Accepted Solutions
ali_hijazi
Partner - Master II
Partner - Master II

if the field is called Date then create a chart with Date as dimension 

then in the expression your set analysis should contain something like this:
{<Date={">= today-10 <= today"}>}

usually I transform dates into numbers so in the script the field Date would be coming as num(DayStart(Date))) as Date

so expression would look like

sum({<Date={">= $(=num(addDays(Today(),-10)) <= $(=num(DayStart(Today()))"}>measure)

I can walk on water when it freezes

View solution in original post

3 Replies
ali_hijazi
Partner - Master II
Partner - Master II

if the field is called Date then create a chart with Date as dimension 

then in the expression your set analysis should contain something like this:
{<Date={">= today-10 <= today"}>}

usually I transform dates into numbers so in the script the field Date would be coming as num(DayStart(Date))) as Date

so expression would look like

sum({<Date={">= $(=num(addDays(Today(),-10)) <= $(=num(DayStart(Today()))"}>measure)

I can walk on water when it freezes
agigliotti
Partner - Champion
Partner - Champion

let's try with this calculated dimension:

Aggr( if( today()-dateField <= 10, dateField ), dateField )

and tick "Suppress When Value Is Null"
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

It depends as always 🙂
If you have the sheet that only contains 10 days data than you can add Trigger in the sheet properties.
If you wish to have Chart table with only 10 days, then you need to use Set Analysis in all of your expressions like:
Count(Count({<Data = {">$(=Date(Today() - 10))"}>} Data))