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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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
Champion III
Champion III

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.