Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
zahidrahim_ocp
Partner - Creator
Partner - Creator

Simple Last 3 Months sale set Expression

Dear Experts,

I am trying to get last 3 months sale but getting only the date selected one day sale. i am using below expression:

SUM({<TRX_DATE = {"$(='>=' & v3MonthsBackDate)"}>}

(IF (TYPE = 'CM', QUANTITY_CREDITED , QUANTITY_INVOICED)/ IF(isnull(LTR_CV_RATE),1,LTR_CV_RATE))

)

where v3MonthsBackDate is a variable with below syntax:


=(ADDMONTHS(Max(TRX_DATE),-3))


Regards,


Zahid Rahim

21 Replies
neha_sri
Creator III
Creator III

Hi Rahim,

Could you please send some sample data.

What I understand is on every date you need sum of last 3 months sales

Sum({<TRX_DATE={">=$(=TRX_DATE(Addmonths(max(TRX_DATE),-3)))"}>}

(IF (TYPE = 'CM', QUANTITY_CREDITED , QUANTITY_INVOICED)/ IF(isnull(LTR_CV_RATE),1,LTR_CV_RATE))

)

Regards,

Neha

sunny_talwar

Two questions

1) Are you selecting in TRX_DATE field or another field?

2) What is the format for TRX_DATE? Do you see the same format when you put this ='>=' & v3MonthsBackDate a text box object?

zahidrahim_ocp
Partner - Creator
Partner - Creator
Author

1. Same Field i-e TRX_DATE

2. Format is same i have checked in a textbox MM/DD/YYYY the default.

sunny_talwar

Don't see anything wrong with your expression.... But tried to simplify the denominator using Alt function... see if that changes anything?

Sum({<TRX_DATE = {"$(='>=' & v3MonthsBackDate)"}>} If(TYPE = 'CM', QUANTITY_CREDITED, QUANTITY_INVOICED)/Alt(LTR_CV_RATE,1))

pradosh_thakur
Master II
Master II

try removing the dollar before the variablein the set expression



=ADDMONTHS(Max(TRX_DATE),-3) as variable description

Learning never stops.
zahidrahim_ocp
Partner - Creator
Partner - Creator
Author

Dear Sunny,

When i remove the filter then i can see last 3 months sale perfectly. But when i apply the filter and select any date then i can see only that date sale.

Regards,

Zahid Rahim

sunny_talwar

Hahahahaha I have read this above... I understand your issue... but just from your expression I don't see why this would happen... your expression looks absolutely correct to me. do you have a calculated dimension?

zahidrahim_ocp
Partner - Creator
Partner - Creator
Author

No there is no calculated dimension.

sunny_talwar

no idea zahidrahim.ocp‌ because like I mentioned your expression looks good to me.... but I might be missing something... may be someone else might be able to find the mistake

pradosh_thakur
Master II
Master II

dis you try my suggestion ? This didn't work?

Learning never stops.