Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

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

Helen

3 Replies
tresesco
MVP
MVP

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)))

prma7799
Master III
Master III

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))))


Or


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

sunny_talwar

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)))

or

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