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

How to set chart dimension to range of two weeks

Hi,

I have a chart with a date field as the dimension. I want the range always be from the date of today until 2 weeks back.

How can I achieve this?

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Nazeem,

Instead of doing in dimension you can try the same in Expression, Calculated Dimension will have performance issues.

=Sum({<MyDate ={'>=$(=Date(Today()-14))<=$(=Today())'}>} MeasureName)


This is a good practice instead of doing it in Dimension.


Regards,

Jagan.

View solution in original post

8 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Write as dimension:

If(Num(MyDate) <= Num(Today()) and Num(MyDate) >= Num(Today()-14), MyDate, null())

let me know

Anonymous
Not applicable
Author

Hi,

You can set the range from chart properties Axes tab.

Min = Date(WeekStart(Today())-14)

Max = Today()

range.PNG.png

Not applicable
Author

In the chart, the dimension is shown as numbers and not as dates.

chart.PNG.png

Not applicable
Author

HI Nazeem

use floor function to convert number to date

regards

padma

jonathandienst
Partner - Champion III
Partner - Champion III

Amend that dimension:

=Date(If(Num(MyDate) <= Num(Today()) and Num(MyDate) >= Num(Today()-14), MyDate, null()))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
alexandros17
Partner - Champion III
Partner - Champion III

so write simply:

If(Num(MyDate) <= Num(Today()) and Num(MyDate) >= Num(Today()-14), Date(MyDate), null())

jagan
Luminary Alumni
Luminary Alumni

Hi Nazeem,

Instead of doing in dimension you can try the same in Expression, Calculated Dimension will have performance issues.

=Sum({<MyDate ={'>=$(=Date(Today()-14))<=$(=Today())'}>} MeasureName)


This is a good practice instead of doing it in Dimension.


Regards,

Jagan.

Not applicable
Author

Thank you!