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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ssai
Frequent Visitor

Using one measure in another measure

Hello community:)

How to use a measure in creating another measure? I have gone through some of the documentation and tutorials but when implemented I am facing issues? Can anyone help me out with this?

The issue is that the cost that I am calculating is not taking into consideration the distinct emp measure instead it is taking the count that was previously present i.e. the values before the distinctEmp measure.

Main measure:

Cost = FORMAT(SUM('table1'[Unitary Cost (cost per unit yearly)])*SUMX('table2','table2'[distinctEmp]), "Standard")
The measure that is used:
distinctEmp = DISTINCTCOUNT('table2'[Employee ID])

Thanks in advance:))

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@ssai  Relationships and context is very important. How is table1 related to table 2?

 

You may need to use a RELATEDTABLE function, change/fix relationships, and maybe adjust your measure. 

 

I'm thinking something like: 

 

Cost = FORMAT(SUMX('table1', 'table1'[Unitary Cost (cost per unit yearly)] * [distinctEmp]), "Standard")

 

but depends what you're trying to calculate.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
AllisonKennedy
Super User
Super User

@ssai  Relationships and context is very important. How is table1 related to table 2?

 

You may need to use a RELATEDTABLE function, change/fix relationships, and maybe adjust your measure. 

 

I'm thinking something like: 

 

Cost = FORMAT(SUMX('table1', 'table1'[Unitary Cost (cost per unit yearly)] * [distinctEmp]), "Standard")

 

but depends what you're trying to calculate.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy  Thankyou very much. The one you suggessted worked perfectly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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