Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

neha_sri
Contributor II

Re: Simple Last 3 Months sale set Expression

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

Re: Simple Last 3 Months sale set Expression

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
Contributor

Re: Simple Last 3 Months sale set Expression

1. Same Field i-e TRX_DATE

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

Re: Simple Last 3 Months sale set Expression

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
Valued Contributor III

Re: Simple Last 3 Months sale set Expression

try removing the dollar before the variablein the set expression



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

zahidrahim_ocp
Contributor

Re: Simple Last 3 Months sale set Expression

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

Re: Simple Last 3 Months sale set Expression

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
Contributor

Re: Simple Last 3 Months sale set Expression

No there is no calculated dimension.

Re: Simple Last 3 Months sale set Expression

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

Highlighted
pradosh_thakur
Valued Contributor III

Re: Simple Last 3 Months sale set Expression

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

Community Browser