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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mcolb88
Helper III
Helper III

Nested Calculated Items in Calculation Group

All, 

 

Fairly new to calculation groups and want to know if the following is possible. 

 

My calculation group has 2 calculated items A and B.  I want to get a percentage, and add a third item C = DIVIDE (A, B). My question is if there is a way to reference the calculation items in the expression for C or do I need to repeat the expression in C, as in DIVIDE ( A expr, B expr). 

 

Reason I ask is for maintainability, if I change A for example, I would need to change the A expression in C, otherwise I would be off. Also, the expression for my B item is quite lengthy and want to keep it easier to read.

 

Thanks

6 REPLIES 6
m_holly10
New Member

This was clutch! Thanks @gronnerup 

gronnerup
Advocate I
Advocate I

Be carefull of using sideways recursion as it can cause a number of problems. Instead write the full expression again.

 

But answering you question this can be achived though

DIVIDE(
   CALCULATE(SELECTEDMEASURE(), 'CalcGroup'[CalcColumn] = "Calc item A"), 
   CALCULATE(SELECTEDMEASURE(), 'CalcGroup'[CalcColumn] = "Calc item B")
)

 

https://docs.microsoft.com/en-us/analysis-services/tabular-models/calculation-groups?view=asallprodu...

 

WCONGRAVE
Advocate I
Advocate I

HI, Did you manage to acheive this? I'm trying to do the same....

harshnathani
Community Champion
Community Champion

Hi @mcolb88 ,

 

Use Variables.

 

https://www.sqlbi.com/articles/variables-in-dax/

https://docs.microsoft.com/en-us/power-bi/guidance/dax-variables

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

I undestand the use of variables, I don't want to repeat the expression in the calculation of item C, I simply want to reference another calculated item. Is that possible?

 

Thanks

Anonymous
Not applicable

You can use one calc item in another in the same group. Just be careful not to introduce infinite loops.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors