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
BWL
Helper II
Helper II

Dax formula

Dear all,

I have some trouble with DAX measures and I don't know how to solve it. This is my data model:
PBI.PNG

I'm trying to make several measures, but I can't get them correct, because of the different dimension tables.
These are the measures:

  • Sums cost per truck per period
  • Counts number of routes per truck per period
  • Cost per truck per period devided by number of routes per period

  • Sums cost per trailer per period
  • Counts number of routes per trailer per period
  • Cost per trailer per period devided by number of routes per period

    PBI1.PNG

I tried to get it fixed with USERELATIONSHIP to define which relationship the measure should use. But this does not work.  

Measure = CALCULATE(SUM(tbl_Cost[Cost]); USERELATIONSHIP(tbl_Cost[Costkey];tbl_Trucks[Costkey]))

 
Can someone please help me?

To clarify I made a demo file which you can find here:

https://www.dropbox.com/s/bx9nwl246qjpg1p/180528%20Demo%20file.pbix?dl=0


Many thanks in advance.

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@BWL,

 

You may try using LOOKUPVALUE Function to add calculated columns first.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-chuncz-msft,


Thanks for your reply!


Do you mean:
So instead of making a measure, make calculated columns in tbl_route with LOOKUPVALUE?

Regards,

BWL

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.