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: 
Not applicable

Set Analysis and Alternate State

Hi,

I have the following expression which returns the results from the last 7 days from a date range selected by the user:

NUM(Sum({[DateCompare]<TestFlag={'Live'}, RefundOrSale={'Sale'},[Level 7]=$::[Level 7],[Level 2]-={'System/Refund','PAYG Pop card'},Date={">$(=Date(Max(Date)-7))<=$(=Max(Date))"}>} MonetaryValue),'£0,000')

This works great and other expressions without the  " Date={">$(=Date(Max(Date)-7))<=$(=Max(Date))"} " means I can show total selection and last 7 days in the same report. Great.

Problem is my use of Alternate States. I have Date in a separate state called "DateCompare". The expression above ignores the Date selection in DateCompare and looks at the default state. I've tried replacing the $ with [DateCompare] but no luck.

Can anyone help with the expression so that the "last 7 dates" refers to the alternate state?

Thank you

Alex

1 Solution

Accepted Solutions
sunny_talwar

May be try this:

Num(Sum({[DateCompare]<TestFlag={'Live'}, RefundOrSale={'Sale'},[Level 7]=$::[Level 7],[Level 2]-={'System/Refund','PAYG Pop card'},Date={">$(=Date(Max({DateCompare}Date)-7))<=$(=Max({DateCompare}Date))"}>} MonetaryValue),'£0,000')

View solution in original post

4 Replies
sunny_talwar

May be try this:

Num(Sum({[DateCompare]<TestFlag={'Live'}, RefundOrSale={'Sale'},[Level 7]=$::[Level 7],[Level 2]-={'System/Refund','PAYG Pop card'},Date={">$(=Date(Max({DateCompare}Date)-7))<=$(=Max({DateCompare}Date))"}>} MonetaryValue),'£0,000')

swuehl
MVP
MVP

Try

NUM(Sum({[DateCompare]<TestFlag={'Live'}, RefundOrSale={'Sale'},[Level 7]=$::[Level 7],[Level 2]-={'System/Refund','PAYG Pop card'},Date={">$(=Date(Max({DateCompare} Date)-7))<=$(=Max({DateCompare}Date))"}>} MonetaryValue),'£0,000')

Not applicable
Author

Thank you, works brilliantly.

Not applicable
Author

Thank you, it works.