Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Contributor II

Fabs Function - Where to place it

Dear Qlikview user

I have some negative values in my dataset which is causing my background colour not to work effectively.

My expression is as follows, and I wanted to know where I would place the Fabs function in the expression

TB_Numerator is the value I need to wrap the FABS function around, without affecting the structure of the rest of the statement

Num(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Sum(TB_Numerator), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric)))

Kind Regards


3 Replies

Re: Fabs Function - Where to place it

Taking positive values and using fabs() are not similar. Having said that, if you want to ignore the negative values you could try something like:

Num(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Sum({<TB_Numerator={">=0"}>} TB_Numerator), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric)))

Honored Contributor III

Re: Fabs Function - Where to place it

Try like this

Num(fabs(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Sum(TB_Numerator), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric))))


Fabs(Num(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Sum(TB_Numerator), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric))))

Re: Fabs Function - Where to place it

May be this

Num(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Sum(Fabs(TB_Numerator)), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric)))


Num(FirstSortedValue({<TB_Numerator={">=0"}>}Aggr(Fabs(Sum(TB_Numerator)), TB_Fact_Date, TB_Metric), -Aggr(TB_Fact_Date, TB_Fact_Date, TB_Metric)))