Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

RutiTaumanRubin
Contributor

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
Esteemed Contributor

Re: Issue with conditional in sum function - Qlik Sense

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)

2 Replies
OmarBenSalem
Esteemed Contributor

Re: Issue with conditional in sum function - Qlik Sense

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
Contributor

Re: Issue with conditional in sum function - Qlik Sense

It's work - Thanks!!

Community Browser