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.
chetansehgal
Contributor

unable to calculate previous Month sales in Qlik Sense

Hi,

I am trying to use below formula in Qlik Sense which works fine in QlikView but not in Qlik Sense.

Sum({<Month_Num={"$(=Max(Month_Num)-1)"}>}[Sales Amount (Actual)])

It gives zero only. in Qlik Sense.

Any help will be appreciated.

Thanks,

Chetan

5 Replies

Re: unable to calculate previous Month sales in Qlik Sense

Have you checked that the field names match exactly? Month_Num is not MonthNum or Month_num? Because I don't see any reason for this expression to not work in Qlik Sense. May be share a sample for us to see?

MVP & Luminary
MVP & Luminary

Re: unable to calculate previous Month sales in Qlik Sense

Please post a small qlik sense app that shows this problem.


talk is cheap, supply exceeds demand
satishkurra
Valued Contributor II

Re: unable to calculate previous Month sales in Qlik Sense

Quick work around is see first the below 2 expressions individually displaying values or not in a TextObkect/Image in QlikSense


=Max(Month_Num)-1


Sum([Sales Amount (Actual)])


Also get the list object for Sales AMount and MOnth_Num to see if values are present

ziadm
Valued Contributor

Re: unable to calculate previous Month sales in Qlik Sense

Hi

Make sure that Month_num is numeric value

Load

Num(Month(Date) as Month_num

or use dual function

Then change your syntax

Sum({<Month_Num={"=Max(Month_Num)-1"}>}  [Sales Amount (Actual)])

Hope this works 

Please tag as correct or helpful if this works for you

Regards

Ziad

chetansehgal
Contributor

Re: unable to calculate previous Month sales in Qlik Sense

Thanks everyone for the help ...

I tried using below formula and it works fine now..but dont know why the previous formula was nor working.

=sum({$<Year={"$(=Max(Year))"},MonthID={"$(=Max(MonthID)-1)"},Month=>}[Sales Amount (Actual)])

Thanks,

Chetan