Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
linoyel
Specialist
Specialist

Using measures in calculated expression

Hi, is it possible to use a measure in a calculated expression?

Or I have to create a variable?

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

That is not possible.. Best way to do this is using variable.

View solution in original post

8 Replies
shraddha_g
Partner - Master III
Partner - Master III

Hi,

You can use measure in calculated expression..also using a variable..

What is the actual requirement.?

linoyel
Specialist
Specialist
Author

Just asking what is the syntax.

For example, if I have a measure Profit YTD and I wand to use it in a calculated expression in Set Analysis.

Please see attached.

Capture.PNG

shraddha_g
Partner - Master III
Partner - Master III

You can use  the expression as it is shown in image by storing set analysis part in variable and thrn using variable in expression

Else you can use actual expression as sample expression shown below

Sum({<OrderDate ={">=$(=max(YearStart)) <=$(=max(OrderDate)) "}>}   Profit)

It depends on expression complexity whether you need to use variable or actual expression.

I hope this is helpful.

Regards,

Shraddha

linoyel
Specialist
Specialist
Author

So there is no way to use the measure I've already defined in expression and I have either to create a variable or just write down the whole thing in an expression. is that right?

shraddha_g
Partner - Master III
Partner - Master III

U can define the expression in master as u have created also with the syntax in my earlier reply.

Then just drap and drop that measure in chart or select from the list while creating a chart in measure section.

But you can not use master measure in another expression

linoyel
Specialist
Specialist
Author

I need to use the measure in Set analysis in expressionm for example for column color: for example,

If Profit YTD <100, then color the column in red.

I guess, I'll just need to add it as a variable.

Thought maybe there was a workaround for not adding the same calculation twice: once for the measure and once in a variable...

shraddha_g
Partner - Master III
Partner - Master III

That is not possible.. Best way to do this is using variable.

linoyel
Specialist
Specialist
Author

OK