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: 
Chris272727
Partner - Contributor
Partner - Contributor

Get Last few days dynamically in Bar chart

Hello Everyone,

Below is my Sample Data. I would like to show last 3 days dynamically in a chart and cumulative sum of TUTStatus which i can get it. I am able to show last 3 days if dates are continuous. 

DateTUTStatus
5/17/2020Completed
5/20/2020Completed
5/23/2020Completed
5/25/2020Completed
5/28/2020Completed

 

Thanks

Chris

Labels (2)
6 Replies
Vegar
MVP
MVP

What is the expected result for your sample data? Could you explain? Maybe post a picture of a mockup bar chart?

Chris272727
Partner - Contributor
Partner - Contributor
Author

Modified Sample data a bit to show the bar chart.

Sample Data

Object

Date

FUT StatusCount
Object15/16/2020Completed 
Object25/17/2020Completed 
Object35/20/2020Completed 
Object45/23/2020Completed 
Object55/24/2020Completed 
Object65/24/2020Completed 
Object75/24/2020Completed 
Object85/24/2020Completed 
Object95/25/2020Completed9
Object105/27/2020Completed 
Object115/27/2020Completed 
Object125/27/2020Completed12

 

Attached Expected Bar chart

Expectation is to get last two or few days dynamically. Like Top 2 or 5 numbers.

 
 

Thanks

 

 

Vegar
MVP
MVP

Vegar_0-1591698547845.png

Try an expression like this:

Sum({<Date = {">$(=max(Date)-3) <=$(=max(Date))"}>}Count)

See attached qvf for an working example.

Chris272727
Partner - Contributor
Partner - Contributor
Author

Thanks for the reply but i think it is still bit off.

I am expecting to see 5/24/2020 also in the bar chart but with below expression its not showing up

Sum({<Date = {">$(=max(Date)-3) <=$(=max(Date))"}>}Count). This expression would show last 3 days i.e 5/27/2020, 5/26/2020 and 5/25/2020.

Since we dont have 5/26/2020 in the data set, I expect 5/24/2020 to appear in the chart. I hope its clear now.

Chris272727_0-1591720815132.png

 

Vegar
MVP
MVP

You want to display the 3 latest registrated days? If so then try something like this:

Sum({<Date = {">=$(=max(Date, 3)) <=$(=max(Date))"}>}Count)

Chris272727
Partner - Contributor
Partner - Contributor
Author

Thanks for the reply. There is no Count field in the data set. Just added to explain the requirement.

Key Dimension is TUTSTatus who status is completed.

Requirement is to display last 3 registrated day who TUTStatus is completed.

ObjectDateFUT Status
Object15/16/2020Completed
Object25/17/2020Completed
Object45/17/2020Not Completed
Object35/20/2020Completed
Object45/23/2020Completed
Object55/24/2020Completed
Object65/24/2020Completed
Object75/24/2020Completed
Object85/24/2020Completed
Object95/25/2020Completed
Object105/27/2020Completed
Object115/27/2020Completed
Object125/27/2020Completed