Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhuprakash
Creator II
Creator II

Want to show last 7 days bar chart

Dear Experts,

I want to show last 7 or 10 days activity counts in bar chart(date wise)

How it is possible ? date format is as below -

 

28/12/2019 12:03:00 PM

Thanks in advance.

Labels (1)
10 Replies
tresesco
MVP
MVP

Could you share a sample set of your data and explain expected output format against that?

Anil_Babu_Samineni

How you will found which are active days? What is the logic behind to do

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bhuprakash
Creator II
Creator II
Author

By default it should be last 7 days like if I open the dashboard then data should be reflect for below dates -

02/01/2020

31/12/2019

30/12/2019

29/12/2019

28/12/2019

27/12/2019

26/12/2019

 

If I filter with any month, like if i filter Nov month for 2019 then data should be reflect for last 7 days for Nov 2019 month.

24 Nov 2019 to 30 Nov 2019.

Attaching the dummy data also.

tresesco
MVP
MVP

Create a new field (say, [Activity Start Time DATE]) in the script using date(floor(.. and use the same field in the chart as dimension and expression like:

 

Count({<[Activity Start Time DATE]={">=$(=Date(Max([Activity Start Time DATE],7)))"}>}[Activity Start Time])

bhuprakash
Creator II
Creator II
Author

Created new columns with below formula -

date(Floor([Activity Start Time]),'DD/MM/YYYY') as chartdate

then using below in bar chart dimention -

Count({<chartdate={">=$(=Date(Max(chartdate,7)))"}>}chartdate)

but error message is coming that "Invalid Dimention"

tresesco
MVP
MVP

Perhaps your date field is not being recognized as date but string. Try modifying your timestamp system variable in script to match your date field format and reload or use date#() to convert string to date inside floor().

lorenzoconforti
Specialist II
Specialist II

See attached

A couple of things: as Tresesco has said, make sure your date field are loaded correctly as date/timestamp; create two expressions which you will switch between when a month is selected

bhuprakash
Creator II
Creator II
Author

Hi Lorenzo,

Thanks, this is what exactly I wanted, but how can I put this in bar or line chart.

I have tried and just changed chart type in your data it but it is not coming correctly -

Untitled.png

lorenzoconforti
Specialist II
Specialist II

Attached

Lorenzo