Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

carl_mason
New Contributor

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
Honored Contributor III

Re: Show data from last 7 days

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
Honored Contributor

Re: Show data from last 7 days

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)

Community Browser