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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qliky88
Creator
Creator

Line Chart Last 14 Days

Hi Experts, 

 

Is it possible to have the last 14 days as a dimension on a line chart, updating the dates as the days progress? 

 

Thanks 🙂 

Labels (3)
1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

Use an expression as the dimension, suppress null values.

=If([DateField] >= Date(Floor(Now()-13),'M/D/YYYY'),Date([DateField],'M/D/YYYY'),Null())

The date format string is dependent on date field.

View solution in original post

4 Replies
jwjackso
Specialist III
Specialist III

Use an expression as the dimension, suppress null values.

=If([DateField] >= Date(Floor(Now()-13),'M/D/YYYY'),Date([DateField],'M/D/YYYY'),Null())

The date format string is dependent on date field.

Kushal_Chawda

You can create a flag in script instead of calculated dimension to have better performnace.

LOAD ..

          if(Date>=today()-13 and Date<=today(),1,0) as  Flag_14_Days

FROM table;

then in measure you can use set analysis to restrict the dimension value

=sum({<Flag_14_Days={1}>}Value)

albertovarela
Partner - Specialist
Partner - Specialist

Other option is to create a measure with set analysis. 


sum({$<Date={">=$(=Date(today()-14,'$(DateFormat)'))<=$(=Date(today()-1,'$(DateFormat)'))"}>}YourField)

qliky88
Creator
Creator
Author

Thanks everyone for their responses 🙂