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: 
annanirvin
Contributor III
Contributor III

Set analysis - compare data of today to yesterday?

Hi.

I'd like to sum the number of orders with certain preferences from the day before my chosen day, e.g. if I choose 11/10/2016 I'd like to sum the number of orders 11/09/2016. I've tried a number of different ways to do this, unfortunately without success. This is my latest try:

=Num(Sum ({<Product={'XF'}, Substatus={'On hold'}, Date={"$(=Date([Date])-1))"}>}Sales), '# ##0','.',' ')

Anyone who can help me, please?

Thanks!

Anna

1 Solution

Accepted Solutions
swuehl
MVP
MVP

First, make sure that your dates are interpreted as dates and stored as dual:

Get the Dates Right

Why don’t my dates work?

Then you can use a dollar sign expansion with expression to calculate the previous date, but you might need to reformat the result to match the field format:

Dates in Set Analysis

if your field format differs from the default, you need to specify it, e.g.

sum({$ <Product={'XF'}, Substatus={'On hold'}, Date={"$(=Date(Max(Date)-1,'MM.DD.YYYY'))"}>} Sales)

View solution in original post

6 Replies
maxgro
MVP
MVP

sum({$ <Product={'XF'}, Substatus={'On hold'}, Date={'$(=date(max(Date)-1))'}>} Sales)

annanirvin
Contributor III
Contributor III
Author

Thanks, but that didn't do it.

swuehl
MVP
MVP

First, make sure that your dates are interpreted as dates and stored as dual:

Get the Dates Right

Why don’t my dates work?

Then you can use a dollar sign expansion with expression to calculate the previous date, but you might need to reformat the result to match the field format:

Dates in Set Analysis

if your field format differs from the default, you need to specify it, e.g.

sum({$ <Product={'XF'}, Substatus={'On hold'}, Date={"$(=Date(Max(Date)-1,'MM.DD.YYYY'))"}>} Sales)

maxgro
MVP
MVP

To check your espression:

- Put the expression into e.g. a straight table chart and leave the expression label empty.

- Hover with the mouse over the expression header in chart (as in image)

- You should see the expression with the dollar sign expansion evaluated and replaced.

- What do you see?

1.png

Anonymous
Not applicable

Num(Sum ({<Product={'XF'}, Substatus={'On hold'}, Date={"$(=max([Date])-1))"}>}Sales), '# ##0','.',' ')

annanirvin
Contributor III
Contributor III
Author

Thanks a lot!