Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
RutiTaumanRubin
Creator
Creator

Issue with conditional in sum function - Qlik Sense

Hi Everyone,

I try to create measure the sum field where date equal to select date minus one month.

I try some option but nothing work , for example:

Sum({$<[Snapshot Date]=,[Snapshot Date] = MonthEnd(AddMonths(Max([Snapshot Date]),-1))}>} Sales)

Could you please advise?

Thank you!!

Ruti.

1 Solution

Accepted Solutions
OmarBenSalem

If u select 14/07/2017

and u want to sum Sales for 14/06/2017:

try this:

sum({<[Snapshot Date]={"$(=addMonths(max([Snapshot Date]),-1))"}>}Sales)

If u select 14/07/2017

and u want to sum Sales for btwn : 01/06/2017 and 30/06/2017

try this:

sum({<[Snapshot Date]={">=$(=MonthStart(addMonths(max([Snapshot Date]),-1))) <=$(=MonthEnd(addMonths(max([Snapshot Date]),-1)))"}>}Sales)

View solution in original post

2 Replies
OmarBenSalem

If u select 14/07/2017

and u want to sum Sales for 14/06/2017:

try this:

sum({<[Snapshot Date]={"$(=addMonths(max([Snapshot Date]),-1))"}>}Sales)

If u select 14/07/2017

and u want to sum Sales for btwn : 01/06/2017 and 30/06/2017

try this:

sum({<[Snapshot Date]={">=$(=MonthStart(addMonths(max([Snapshot Date]),-1))) <=$(=MonthEnd(addMonths(max([Snapshot Date]),-1)))"}>}Sales)

RutiTaumanRubin
Creator
Creator
Author

It's work - Thanks!!