Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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.

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

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