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

Show last 28 days on bar chart

Qlik Sense question: I've searched several forums and spent hours trying to figure this out but I'm stuck. I have a bar chart that I want to show the last 28 days of 1 data point only. I've tried the following and they are not working. Qlik says "OK" to the formula but the chart is still showing more than 28 days. Any other thoughts? I'm not familiar with scripts to trying to do this using set analysis. The Excel file is simple - Column A is Date, Column B is Instock %. Thoughts?

=Date(today()-28, 'MM-DD-YYYY')
 
=If(Date((today()-28 and Date(today()))), Date,)
 
=IF((Date >(today() AND Date(today()-28 ))), Date,'')

 

Labels (3)
18 Replies
RyanP
Contributor III
Contributor III
Author

Michele,

I tried that and received the following error:

 

RyanP_0-1664894704673.png

 

RyanP
Contributor III
Contributor III
Author

 I already have date as a dimension. Below is the error I received on the expression: 

RyanP_1-1664895027390.png

 

RyanP
Contributor III
Contributor III
Author

This is close to what I'm looking for; however, I want to show the dates from oldest to newest. When I sort descending, it puts the newest date first. I'm guessing there's not a way to put a max on the dates but still sort where the oldest date is listed first?

deepanshuSh
Creator III
Creator III

I think not directly, but you can first sort the data in the expression using order by function and then do my previous suggested solution. 

Trial and error is the key to get unexpected results.
RafaelBarrios
Partner - Specialist
Partner - Specialist

hi @RyanP 

Sorry, i made a mistake in the formula

sum({<Date={">=$(=date(today()-28))<=$(=today())"} >}Sales)

Remember to use this formula as expression

and as dimension only the date field.

 

it should shows as dimension the las 28 days whiout using an IF in the dimension.

Best,

RyanP
Contributor III
Contributor III
Author

Hi Rafael. Qlik said the formula was "OK" but the visualization still says "Invalid dimension." Any other thoughts as to why?

RyanP_0-1665178538169.pngRyanP_1-1665178556342.png

 

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @RyanP 

are you using my expression as dimension?

If not, please paste here what you have as dimension

best,

RyanP
Contributor III
Contributor III
Author

Sorry the delay. I'm fairly new to Qlik so I had to research expressions as dimensions. I did do that and now it's working perfectly! I appreciate the help!

RyanP
Contributor III
Contributor III
Author

Rafael,

I did a custom measure for the expression and then selected it. Is that what you were referring to? Either way, it's working when done this way. 

 

RyanP_0-1665520076189.png