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: 
Zara
Contributor III
Contributor III

Avg of a Master Measure

Good afternoon,

I have created a master measure which is price1 - price2. Its called 'Profit'

I would now like to use this master measure within an expression. I would like to do avg(profit).

Please can someone let me know if this is possible and if so what the syntax is.

I've tried -

avg=("Profit")

avg([Profit])

avg=[Profit]

Labels (1)
1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Although using directly the expression =Avg(Price1-Price2) is supported, it seems that using the expression =Avg(MyMasterMeasure) might not be. If you create an expression Price1 - Price2 then it is equivalent to Only(Price1 - Price2), therefore Avg(MyMasterMeasure) becomes equivalent to Avg(Only(Price1 - Price2)) and thus the result becomes null due to the double aggregation. Additional information about Only() can be found here [1]. I would suggest you to use directly =Avg(Price1-Price2), instead of =Avg(MyMasterMeasure), but you can also submit a feature request [2], if you want.

 

---

[1] https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/only-tuto...

[2] https://community.qlik.com/t5/Knowledge-Base/How-To-Submit-Feature-Requests-For-Qlik-Products/ta-p/1...

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Although using directly the expression =Avg(Price1-Price2) is supported, it seems that using the expression =Avg(MyMasterMeasure) might not be. If you create an expression Price1 - Price2 then it is equivalent to Only(Price1 - Price2), therefore Avg(MyMasterMeasure) becomes equivalent to Avg(Only(Price1 - Price2)) and thus the result becomes null due to the double aggregation. Additional information about Only() can be found here [1]. I would suggest you to use directly =Avg(Price1-Price2), instead of =Avg(MyMasterMeasure), but you can also submit a feature request [2], if you want.

 

---

[1] https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/only-tuto...

[2] https://community.qlik.com/t5/Knowledge-Base/How-To-Submit-Feature-Requests-For-Qlik-Products/ta-p/1...

Help users find answers! Don't forget to mark a solution that worked for you! 🙂