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
justinharter
Frequent Visitor

Calculated Column Using Related Tables / Records

I'm trying get to a total server cost for an application that may have many servers assigned to it. I have the following table structure below, but I can't seem to figure out the DAX syntax to get the calculated column I want. Essentially, I want the application record in the Application table to SUM the costs for each server that might be assigned to it (those costs are listed in the server table and are related by the "AppToServerAssignments" table).

 

I realize there might be a better way to do this than even using a calculated column so any insight would be greatly appreciated. In the end, I'd like to have a Card visualization that shows the applications total server annual server cost.

 

Data Structure.PNG

3 REPLIES 3
v-sihou-msft
Employee
Employee

@justinharter

 

In this scenario, since you also want to use a card to show total annual cost, you should create a measure in your App table to have the cost data sliced by current filter context. Just use formula: =CALCULATE(SUM(Server[Cost]))

 

1234.PNG

 

Regards,

Simon Hou

 

 

Simon,

 

Thanks for the response. This definitely gets me closer. I noticed your answer provides a solution if the cardinality is 1 to 1 between "AppToServerAssignments" and "Server". However, I have some servers assigned to multiple apps so I end up with the cardinality shown below in the picture. I noticed if I have this cardinality, it sums the servers for each app, but it only counts the server once (i.e. if the server is tied to another app, then it doesn't sum that). Essentially, I notice the Total Cost of Ownership for all applications that I have showing on my card visualization is the SUM of all of the servers tied to particular applications IF i removed all of the duplicate server names. Hope that makes sense.

 

Screenshot.PNG

I've noticed if I make the Total a calculated column instead of a measure, then the card visualization shows the appropriate number. Not sure why this would be...

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.