Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
RutiTaumanRubin
Contributor

Issue with Measure in QlikSense

Hi,

I create measure that present sum of sales

when the user selection in field [Snapshot Date] Minus One Month equal to field [Prev Snapshot Date]:


Sum(IF(FLOOR(date([Prev Snapshot Date],'MM/DD/YYYY')-date(MonthEnd(AddMonths([Snapshot Date],1)),'MM/DD/YYYY'))=0,Sales))


It doesn't work..


Could you please advise?


Thank you!

2 Replies
ali_hijazi
Honored Contributor

Re: Issue with Measure in QlikSense

floor takes numeric values whereas you are passing date values
you can write the following:
sum(if(num(daystart([prev snapshot date])) - num(daystart(monthEnd(date(addmonths(snapshotdate,1))))) = 0 ,sales)

keep in mind monthEnd expects a date value where as you are passing a numeric value returned by addmonths function

I can walk on water when it freezes
RutiTaumanRubin
Contributor

Re: Issue with Measure in QlikSense

Thank you for your response..

It doesnt work as you suggest ..

Maybe you mean to  -  addmonths(snapshotdate,-1) :

sum(if(num(daystart([prev snapshot date])) - num(daystart(monthEnd(date(addmonths(snapshotdate,-1))))) = 0 ,sales)


if I do so it brinfs me the sum of sales in cueenrt date selection and not cueenrt date selection minus one month