Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

paulyeo11
Valued Contributor II

GP% measure , may i know how to make it display 19.5% ?

Hi All

I have below expression , it return 0.00 on GP% measure  , may i know how to make it display 19.5% ?

Hi All

I have below expression :-

(
Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000
-
Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate/1000
)
/
Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000

May i know how to make it display 19.5% ? now it display 0.00

Paul

1 Solution

Accepted Solutions

Re: GP% measure , may i know how to make it display 19.5% ?

Try this:

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000

-Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate/1000)/

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000)

11 Replies
paulyeo11
Valued Contributor II

Re: GP% measure , may i know how to make it display 19.5% ?

my QVF file

Re: GP% measure , may i know how to make it display 19.5% ?

Do you know why I cannot see your chart?

Capture.PNG

paulyeo11
Valued Contributor II

Re: GP% measure , may i know how to make it display 19.5% ?

Hi Sunny

sorry i re-send the QVF file again.

MVP
MVP

Re: GP% measure , may i know how to make it display 19.5% ?

Note the extra parenthesis around the divisor to ensure that the division is correct and remove the 1000 scale factor to simplify:


Num((Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate)

-

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate)

/

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate), '0.0%')

You could possible also remove the Rate value if it is the same at the top and the bottom...

paulyeo11
Valued Contributor II

Re: GP% measure , may i know how to make it display 19.5% ?

Hi Jonathan

Can you send the QVF file to me ? As i try your expression , i get wrong value. , i get 346K. very big value.

Paul

paulyeo11
Valued Contributor II

Re: GP% measure , may i know how to make it display 19.5% ?

Hi all

Does any one able to help me check why Jonathan expression look correct but return wrong GP% ?

Paul

Re: GP% measure , may i know how to make it display 19.5% ?

Try this:

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000

-Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate/1000)/

(Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, rEVENUE={"rEVENUE"} >} Amount*1)/Rate/1000)

paulyeo11
Valued Contributor II

Re: GP% measure , may i know how to make it display 19.5% ?

Hi Sunny

Finally it work.

I still unable to duplicate how you make it , it look simple , but not , i need to a cool mind to figure out why ?

Paul

Re: GP% measure , may i know how to make it display 19.5% ?

I just copy and pasted the two expressions from (GP) / (Sales) (Note the parenthesis around the Sales's expression in the denominator)

Community Browser