Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

siddharth_s2
New Contributor III

Measure not working as desired

Hi all,

I have the below measure with set analysis:

SUM({<[CloseDate]={'>=$(vMaxDateLastMonthStart)<=$(vMaxDateLastMonthEnd)'}>}Sales)

vMaxDateLastMonthStart: =date(num(Monthstart(MonthStart(max(CloseDate))-1)))

vMaxDateLastMonthEnd: =date(num(MonthStart(max(CloseDate))-1))

The measure works fine when I select this month but when I select last month, the measure becomes zero.

The date variables however are fine. I.e. when I select say July, vMaxDateLastMonthStart shows June 1st & vMaxDateLastMonthEnd shows June 30th.

Is there anything wrong with my set analysis? How come it works only for the current month but the previous months become zero.

Regards,

SS.

1 Solution

Accepted Solutions

Re: Measure not working as desired

It will work... your month selection will drive Max(Close Date) which will show you the result you want to see.... but the problem is that as soon as you select a month, the other months zero out.... that is why you need to ignore Month and probably the year field.... give it a shot and see if it doesn't work

4 Replies

Re: Measure not working as desired

May be you just need to ignore selection in Month field?

Sum({<[CloseDate]={'>=$(vMaxDateLastMonthStart)<=$(vMaxDateLastMonthEnd)'}, Month, Year>}Sales)

siddharth_s2
New Contributor III

Re: Measure not working as desired

Ah no, I want them to work.

If I have selected June then the measure should display sales of May.

Any ideas how my date variables are working but my measure says a big fat zero?

Re: Measure not working as desired

It will work... your month selection will drive Max(Close Date) which will show you the result you want to see.... but the problem is that as soon as you select a month, the other months zero out.... that is why you need to ignore Month and probably the year field.... give it a shot and see if it doesn't work

siddharth_s2
New Contributor III

Re: Measure not working as desired

Perfect thanks.

Community Browser