Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression help- quarter

Hi Experts,

i have the below expression:

NUM(rank(-(aggr(

(Sum({<MonthYear =,Date=  {">=$(=date(MonthStart(vMaxSalesDate)))<=$(=date(vMaxSalesDate))"}>} UnitSales)

/

Sum({<MonthYear =,Date=  {">=$(=date(MonthStart(vMaxSalesDate)))<=$(=date(vMaxSalesDate))"}>} TotalSales))

-

(Sum({<MonthYear =,Date= {'>=$(=Date(MONTHSTART(AddMonths(vMaxSalesDate, -1))))<=$(=Date(MONTHEND(AddMonths(vMaxSalesDate, -1))))'} >} UnitSales)

/

Sum({<MonthYear =,Date= {'>=$(=Date(MONTHSTART(AddMonths(vMaxSalesDate, -1))))<=$(=Date(MONTHEND(AddMonths(vMaxSalesDate, -1))))'} >} TotalSales))

, Branch))

))

the expression calculates rank of sales % - Current month vs Previous month.

this woks fine for monthly selection.

but when a quarter is selected, the value is not getting changed.

for ex., if i click on Q4, the expression shows rank for current month and not for the quarter.

how can i change the expression for a quarterly view.

Pls help.

Labels (1)
5 Replies
Anonymous
Not applicable
Author

Becoz you have bypassed the Date= and quarter you have created on Date field, I hope so..

Not applicable
Author

Hi,

thanks for the reply

sorry i dont understand

Can you please help me with the expression change for quarter

Not applicable
Author

Pls somebody give suggestions

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:


NUM(rank(-(aggr(

(Sum({<MonthYear =,Date=  {">=$(=QuarterStart($(vMaxSalesDate)))<=$(vMaxSalesDate)"}>} UnitSales)

/

Sum({<MonthYear =,Date=  {">=$(=QuarterStart($(vMaxSalesDate)))<=$(vMaxSalesDate)"}>} TotalSales))

-

(Sum({<MonthYear =,Date= {'>=$(=QuarterStart($(vMaxSalesDate), -1))<$(=QuarterStart($(vMaxSalesDate)))'} >} UnitSales)

/

Sum({<MonthYear =,Date= {'>=$(=QuarterStart($(vMaxSalesDate), -1))<$(=QuarterStart($(vMaxSalesDate)))'} >} TotalSales))

, Branch))

))


talk is cheap, supply exceeds demand
Not applicable
Author

gysbert,

thanks for the reply.

actually for a quarter, i shouldnt change the calculation as current quarter - prev quarter.

i should do quarter with logic curr month - prev month.

i have posted sample in thread 926337.

pls help me on that