Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
djbloiss
Contributor III
Contributor III

Sum last 5 days orders for any customer that purshased yesterday

I am trying to create an expression that will show all the cases a customer purchased ealier in the week if the purchased yesterday.  So if they bought from my company yesterday and monday then show mondays results.  If they purchased yesterday and noting earlier in the week, nothing.

sum({$<[Customer Adj]=p({<[Invoice Date Num]={$(=vxToday-1)}>}), [Invoice Date Num]={">=$(=vxToday-6))<=$(=vxToday-2)"}>} [Cases_Aggr])

it isn't showing any cases for customers that ordered earlier in the week.

13 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Okies... I thought he found it...

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jyothish8807
Master II
Master II

Hi Daniel,

Hope this helps you. (refer attached)

sum({$<[Name]=p({<[Date]={'$(=date($(vxToday)-1))'}>})*p({<[Date]={'$(=date(weekstart($(vxToday)-1)))'}>}),Date={'$(=date(weekstart($(vxToday)-1)))'}>}Sale)

Br,

KC

Best Regards,
KC
qliksus
Specialist II
Specialist II

Yyou have to check the data of Yesterday and Monday right? . Assuming you use the Today() function try the below

if(  (Sum({$<[Invoice Date Num]={'$(=vxToday-1)' } >} [Cases_Aggr]) and  sum({$<[Invoice Date Num]={'$(date( today() - (num(weekday(Today()))-1)))' } >} [Cases_Aggr]) ) >0 ,

sum({$<[Invoice Date Num]={'$(date( today() - (num(weekday(Today()))-1)))' } >} [Cases_Aggr]) ,

Sum({$<[Invoice Date Num]={'$(=vxToday-1)' } >} [Cases_Aggr])

)

swuehl
MVP
MVP

Daniel Blois wrote:

That was a typo, so that isn't the issue. Have any other ideas?

Well, it would be helpful if you could add more context to your issue description: Data model, context of the expression in your chart (dimensions, other settings).

Then, try building the expression step by step. You can split your set expression into two expressions to check if the filter on the customer as well as the invoice date filter work as expected on their own.

Double check that your dollar sign expansions expands to the numbers you expect and that these numbers match the values in the date field.