The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a fact table [Fact].[Surgeries] that has columns like SurgeryDate, SurgeryDuration, SurgeryCost, SurgeonID (key to Dim.Surgeon), SurgeryID (key to Dim.Surgery).
In Dim.Surgery, there is a column SurgeryStandardDuration.
I am trying to get a comparison of actual duration vs standard duration via two SUM measures.
SUM(Fact.Surgeries[SurgeryDuration]) returns the accurate sum of minutes when grouped by surgeon but SUM(Dim.Surgery[SurgeryStandardDuration]) is only returning a sum of one of each surgery as filtered by the SurgeryID.
Is there a way to write the DAX to apply the SurgeryStandardDuration value to each row in the Surgeries fact before summing or do I need to make a calculated column in Fact.Surgeries and then sum that?
Solved! Go to Solution.
Try this measure:
Std Surgery Duration = SUMX('Fact.Surgeries',RELATED('Dim.Surgery'[SurgeryStandardDuration]))
Try this measure:
Std Surgery Duration = SUMX('Fact.Surgeries',RELATED('Dim.Surgery'[SurgeryStandardDuration]))
This worked great. Thank you!
Hello @funkyman50
Could you please provide sample data that fully represents your issue or question in a usable format, rather than a screenshot? Ensure the dataset is anonymized and does not contain any sensitive or unrelated information.
Additionally, it would be very helpful if you could share the expected outcome based on the provided data - this can be in any format, including a screenshot. Having a clear reference for comparison will significantly improve the chances of getting the correct solution in the first response.
For best practices, you may find the following links useful:
Also let us know whether you prefer having a calculated column or, a measure. As far my current understanding of your issue, I think you can explore the RELATED()
function in DAX to resolve your issue.
Here are the links to understand how RELATED()
function works:
Best Regards,
Udit
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
✨ Visit My Linktree: LinkTree
Proud to be a Super User
User | Count |
---|---|
28 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
12 | |
9 | |
7 |