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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
kevbrown
Creator II
Creator II

Rolling Period

I'm looking to create a bar chart of a count over the last 7 days by day, so for today, sunday to saturday, tomorrow will show Monday to Sunday.  I'm sure this is easy but I can't get to grips with it.  I have a date and week fields in my data.

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Try something like this:

Create a bar chart with dimension DateField and as expression something like this (assuming a date format like 'MM/DD/YYYY' for your DateField, adapt accordingly

=Sum({<DateField = {">=$(=Date(Today()-6,'MM/DD/YYYY'))<=$(=Date(Today(),'MM/DD/YYYY'))"}, WeekField=>} Value)

View solution in original post

5 Replies
swuehl
Champion III
Champion III

Try something like this:

Create a bar chart with dimension DateField and as expression something like this (assuming a date format like 'MM/DD/YYYY' for your DateField, adapt accordingly

=Sum({<DateField = {">=$(=Date(Today()-6,'MM/DD/YYYY'))<=$(=Date(Today(),'MM/DD/YYYY'))"}, WeekField=>} Value)

kevbrown
Creator II
Creator II
Author

Thanks, thats great. Next question, I now want to add another aspect to the calculation. So as well as the following expressions - =Count(DISTINCT{<[Date] = {">=$(=Date(Today()-6,'DD/MM/YYYY'))<=$(=Date(Today(),'DD/MM/YYYY'))"}, [Financial Week]=>} [Issue ID]) - I want to look at only where the field  Reporting Area = Dissatisfaction

swuehl
Champion III
Champion III

That should be pretty simple, too:

=Count(DISTINCT{<[Reporting Area]={'Dissatisfaction'}, Date] = {">=$(=Date(Today()-6,'DD/MM/YYYY'))<=$(=Date(Today(),'DD/MM/YYYY'))"}, [Financial Week]=>} [Issue ID])


A Primer on Set Analysis

kevbrown
Creator II
Creator II
Author

Superb, worked a treat. Next question. Say i want a rolling 13 week. I do have week in my data so would i just swap week for date or even look use the current criteria but use 13 weeks worth of days, so, -91

swuehl
Champion III
Champion III

You mean, replace the -6 by -91?