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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Show data from last 7 days

Hi,

I'm trying to create a simple table which shows the user a total for a selected day and the total for the last 7 days. Ideally, I need to do this without any scripting or variables.

My table looks something like this:-

Ticket_DateTicket_Week_StartWeight
1/1/171/1/1710
2/1/171/1/1712
3/1/171/1/1716
4/1/171/1/1712
5/1/171/1/1710
5/1/171/1/1712
9/1/178/1/1715
9/1/178/1/1710

The user selects a date from a list and it shows the total weight for that date. I also want a column that gives the last 7 days. I've tried using set analysis but don't seem to be doing it right.

The expression I'm using at the moment is:-

Code

SUM({ 1<Ticket_Date = {">$(=getfieldselections(Ticket_Date)) - 7, 'DD/MM/YYYY')"}> } Weight)

This current returns: 0

Thanks in advance for any help!

2 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try,



SUM({ <Ticket_Date = {">$(=Date(Max(Ticket_Date) - 7, 'DD/MM/YYYY'))"}> } Weight)

or

SUM({ <Ticket_Date = {">$(=Date(Max(Ticket_Date) - 7, 'D/M/YY'))"}> } Weight)

stabben23
Partner - Master
Partner - Master

Hi Carl,

this is another way of doing it, always last 7 day dynamic

sum({<Ticket_Date={"<=$(=max(date(addmonths(Ticket_Date, 0))))>=$(=max(date(addmonths(Ticket_Date, 0)-7)))"}>} Weight)