Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use an expression in a calculated dimension

Hi everyone ,

I hope you can help me with this issue.

I have this data :

 

IDID2Quantity1Quantity2Flag
ABC123ABC123-11015Validated
ABC123ABC123-21012Validated
ABC123ABC123-31515Validated

I tried to have a table to show only lines where the sum of quantity1 < the sum of quantity2 when flag="Validated".

I have variables like this :

v_quantity1 = sum({<Flag={'Validated'}>} quantity1)

v_quantity2 = sum({<Flag={'Validated'}>} quantity2)

I tried to use a calculated dimension like this :

- Test 1 : if($(v_quantity1) < $(v_quantity2),1,null()) + check the box "suppress when the values is null"

- Test 2 : if( if(Flag="Validated",sum(quantity1) < if(Flag="Validated",sum(quantity2),1,null()) + check the box "suppress when the values is null"

It doesn't work. I have this error : "Garbage after expression"

I simplify my issue but I have to do a sum. I have others filters like X = "1" for example and it works in a calculated dimension.

Do you have any idea please ?

Kind regards ,

Gwendaline

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi,

maybe this

Dimensions :

ID

Aggr(If(Sum(Quantity1) < Sum(Quantity2) and Flag = 'Validated',ID2),ID2)

Flag

Regards,

Antonio

View solution in original post

3 Replies
antoniotiman
Master III
Master III

Hi,

maybe this

Dimensions :

ID

Aggr(If(Sum(Quantity1) < Sum(Quantity2) and Flag = 'Validated',ID2),ID2)

Flag

Regards,

Antonio

Not applicable
Author

Yes, it works !

Thank you Antonio !

ViktoriyaParshin
Contributor
Contributor

Hello,

Maybe, somebody faced this problem and could help me :-).

I created the calculated column. After the receiving the results, I need remove "Null"s

"Expressions" returns me the correct results, but impossible remove Null values in model

Calculated dimension, where Null remove is possible, - presents not correct results .

my calculation is:

=if (T_Number = Max_T_Number or (IsNull (T_Number) and Qty_On_Hand > 0.1 ), 'New', Null())

Number

T_Number

Max_T_Number

Expressions

Calculated dimension

Qty_On_Hand

ABC1

 

 

New

 

1

ABC2

T119565

T119566

New

New

 

ABC3

 

 

New

 

1

ABC4

T119568

T119568

New

New

 

ABC5

 

 

 

 

 

 

thank you!