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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
glykk
Regular Visitor

Dynamic Calculation based on Attribute across relationships

HI,

I'm having an issue with some caluclations I need to perform.

 

My first table looks something like this -
Data
Name | unit | amount

John   | B     | 5

Paul    | A    | 10

fooo    | B    | 5

baar    | A    | 2

...

 

I then have a table of assumed ratios:

Assumptions

Unit  | Cost of Sales | support cost
A      | 0.16%           | 0.14%  

B       | 0.18 %          | 0.16 %

....

 

Now I need to calculate certain measures depending on what the Unit assigned is so for example I would calculate the Cost of Sales ratio as 

A cost of sales =  CALCULATE(SUM('Data'[Amount]*SUM'Assumptions'[Cost of Sales], filter(Assumptions,Assumptions[Unit]="A")) 

B cost of sales = CALCULATE(SUM('Data'[Amount]*SUM'Assumptions'[Cost of Sales], filter(Assumptions,Assumptions[Unit]="B"))

C cost of sales = CALCULATE(SUM('Data'[Amount]*SUM'Assumptions'[Cost of Sales], filter(Assumptions,Assumptions[Unit]="C"))

....

N cost of sales = CALCULATE(SUM('Data'[Amount]*SUM'Assumptions'[Cost of Sales], filter(Assumptions,Assumptions[Unit]="N"))

 

Total cost of sales = [B cost of sales] + [A cost of sales] +... [N cost of sales]

 

this approach is far too tedious when you are working with 50+ units across and multiple assumptions -

 

if there a better way of performing calculations like this?

1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

Hi @glykk,

 

Once you have created a One-To-Many relationship, you can do it like this:

 

 

 

=
SUMX (
    VALUES ( Assumptions[Cost of Sales] ),
    Assumptions[Cost of Sales] * CALCULATE ( SUM ( Data[amount] ) )
)

 

2018-12-11_14-43-36.jpg

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

1 REPLY 1
LivioLanzo
Solution Sage
Solution Sage

Hi @glykk,

 

Once you have created a One-To-Many relationship, you can do it like this:

 

 

 

=
SUMX (
    VALUES ( Assumptions[Cost of Sales] ),
    Assumptions[Cost of Sales] * CALCULATE ( SUM ( Data[amount] ) )
)

 

2018-12-11_14-43-36.jpg

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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