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
Parthsh93
Helper IV
Helper IV

Divide with denominator as measure and numerator as related values from different table

Hi

I am trying to define measure that gives "cost per kilometer"

 

I have a fact table having [Equipment], [Loaded Distance] and [Deadhead Distance] column

a dimention table called fixed Cost having [Equipment N] and [Fix Cost] columns

 

14.PNG

 

I have a measure

 

 

Equipment KMS = CALCULATE(SUM('Prototype Modeling_Freight'[Loaded Distance]) + SUM('Prototype Modeling_Freight'[Deadhead Distance]))

 

 

 

Shown as a table visualization

13.PNG

Through a relationship connection between Equipment and Equipment N

12.PNG

 

MY REQUIREMENT :

A measure defined for each equipment as [Fix cost] / [Equiment KMS]

 

TIA

5 REPLIES 5
harshnathani
Community Champion
Community Champion

Hi @Parthsh93 ,

 

You can use this measure.

 

Measure = Divide (Calculate (Sum ('Table'[FixedCost])), [Equipment Kms])

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a  Kudos!!

@harshnathani

Thanks for replying

 

I tried your formula as

FC Per KMS = Divide (Calculate (Sum ('Fixed Cost'[Fix Cost])), [Equipment Kms])

But not getting correct results

15.PNG

Hi @Parthsh93 ,

 

You can try this.

 

Divide (Calculate (Sum ('Fixed Cost'[Fix Cost]),ALLEXCEPT (Fixed Cost, 'Fixed Cost' [Equipment])), [Equipment Kms])

 

Also, convert your measure into decimals and make the values are 'Dont Summarize'

 

Imcase this does not work, please share some sample data.

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

Thanks @harshnathani 

 

This didnt work either

 

Sorry I cant share data in document as I am restricted to do that

 

Although, I would like to know one thing, can we use unique related values from a dimention table and use them in the expression ?

for eg:

the column [equipment] in my fact table is related to [equipment N] in dimention table.

Now what I want is to pull this fix cost from dimention table and use it in an expression, so that it goes to dimention table and give me the related value for every row iteration.

I am able to use it in a direct table visualization, but can't use it in a mathematical expression

16.PNG

Parthsh93
Helper IV
Helper IV

Is this not possible?

 

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.

Top Solution Authors