Qlik Community

Qlik Sense App Development

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

paulyeo11
Valued Contributor II

How can i avoid using if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1) ?

Hi All

I have a Target table , it have a column "Diff1" when i use :-

if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1)

it return correct % .

If i use below expression :-


(
Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1/1000)
-
Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1/1000)
)
/
(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1/1000))

iot return wrong only on G1 Row. it give 95% it should be 49%.

May i know how to make both same ?

Paul

1 Solution

Accepted Solutions

Re: How can i avoid using if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1) ?

I think the two expressions are totally different. See if this is what you wanted:

If(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1/1000) = 0, 1,

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1/1000)

/

fabs(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1/1000)) - 1)

3 Replies
paulyeo11
Valued Contributor II

Re: How can i avoid using if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1) ?

my qvf

Re: How can i avoid using if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1) ?

I think the two expressions are totally different. See if this is what you wanted:

If(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1/1000) = 0, 1,

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1/1000)

/

fabs(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1/1000)) - 1)

paulyeo11
Valued Contributor II

Re: How can i avoid using if(fabs(column(1))=0,1,column(2) / fabs(column(1))-1) ?

Hi Sunny

you are good, thank !

Paul

Community Browser