Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Growth %

I am applying the following expression to calculate the growth rate as per user selection and it is working fine. But  when I have negative figure of Premium for  Previous period growth rate calculates  wrong rate.

Eg Premium for the Current period is 100,000

     Premium for the previous period is -25,000

     Growth Rate given by the following expression is -500%

     But the correct rate should be 500%

pls help me correct the expression to calculate correctly

(sum({$<PERIODID = {"<=$(=Max(PERIODID))"},YEAR ={$(=Max(YEAR))},QUARTER =,MONTH =,PERIOD =>}[PREMIUM])

-sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM]))

/sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM])*100

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Fab(

(sum({$<PERIODID = {"<=$(=Max(PERIODID))"},YEAR ={$(=Max(YEAR))},QUARTER =,MONTH =,PERIOD =>}[PREMIUM])

-sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM]))

/sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM])*100)

View solution in original post

4 Replies
Gysbert_Wassenaar

You can calculate the absolute value of the growth rate by using the fabs function:

fabs( ...your_expression_here... )


talk is cheap, supply exceeds demand
upaliwije
Creator II
Creator II
Author

Dear Gysbert

Where should I actually type fabs command. Kindly reproduce my expression having inserted the fabs function in the right place

Thanks

MK_QSL
MVP
MVP

Fab(

(sum({$<PERIODID = {"<=$(=Max(PERIODID))"},YEAR ={$(=Max(YEAR))},QUARTER =,MONTH =,PERIOD =>}[PREMIUM])

-sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM]))

/sum({$<PERIODID = {$(=Max(PERIODID)-12)},YEAR =,QUARTER =,MONTH =,PERIOD =>}[PREMIUM])*100)

upaliwije
Creator II
Creator II
Author

It is working

Thanks a lot