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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis for date

Hi,

I am trying to make a table with data for the past 5 days. This is the expression I am using:

Sum( {$< EventDate = {'$(vMaxDate)'},Account= -{'500','400'} >} Revenues).

What is the correct way to write this expression so that I have vMaxDate-1, vMaxDate-2......vMaxDate-5 in the set analysis? I have tried having the "-number" in different places in the equation but I keep on getting 0. Help appreciated.

Cheers.

22 Replies
Not applicable
Author

Try:

Sum( {$< EventDate = {'$(=Date($(vMaxDate))-5)'},Account= {'*'}-{'500','400'} >} Revenues).

PradeepReddy
Specialist II
Specialist II

can you share the application?

Not applicable
Author

this doesn't work

Not applicable
Author

Hi Nag,

This returns the default value which I already have ie MaxDate. However, in the case of MaxDate-1,-2....-5, the value returned is 0.

MK_QSL
MVP
MVP

Provide sample data...

Not applicable
Author

Hi Jose,

This returns a zero value to my table.

Not applicable
Author

Pradeep, unfortunately I don't know how I can share the application due to it's size, data model, sources and also without leaking sensitive info...

MK_QSL
MVP
MVP

You can create some dummy data similar to your apps and share in excel file along with the output you required.

Not applicable
Author

Based on the variable you shouldn't need that second dollar expand, I think the below should work

=SUM({<EventDate = {'>=$(=Date(vMaxDate-4))<=$(vMaxDate)'},Account= -{'500','400'}>}Revenues)

hope that helps

Joe

Not applicable
Author

Hi Joe,

This expression gives me the sum of all revenues for 5 days. However I would like to have

Day 1: xxxx

Day 2: yyyy

Day 3: zzzz.

The formula as is does work though