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
theDarkPrince
Advocate II
Advocate II

Using value from another linked table in a measure

Hi Guys. I'm stuck really bad in this one. I have 2 tables : 1. Facts table 2. Dimesnion table. Following image depicts the relationship established between the 2. The table at the top is the Facts table. "OI Owrking Days" is the dimension table.

 

theDarkPrince_0-1603388074326.png

I wish to create a multiline chart which will have the "FY" field in the legend well, Month field in Axis well and a measure in the Values well. The measure is supposed to calculate Per day amount so the formula for the same would be : SUM(Amount)/working days. I need to have the working days to be fetched from dimension table for each month that is plotted on the X-Axis. Following is what I have tried so far :

Amt Per Day =
var AmtPerDay = [Total Amount] / FILTER( 'Facts Table', RELATED( 'Dimensions Table'[WORKING_DAYS] ) )
RETURN
AmtPerDay
Note : Both the tables are fetched using DirectQuery mode. 😐
Any help is appreciated. 
3 REPLIES 3
amitchandak
Super User
Super User

@theDarkPrince , Try like

Amt Per Day =
var AmtPerDay = [Total Amount] / Sumx( 'Facts Table', RELATED( 'Dimensions Table'[WORKING_DAYS] ) )
RETURN
AmtPerDay

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

I'm afraid that did not work @amitchandak. Check out the image below :

 

theDarkPrince_0-1603429684361.png

 

This is how the line chart shoud look like. But it looks like :

theDarkPrince_1-1603429746804.png

 

I am not sure how to get the desired results. Been trying a lot of different functions since last 2 days but nothing has worked thus far. 😞

Hi @theDarkPrince ,

 

Would you please use the following measure:

 

 

Amt Per Day =
var AmtPerDay = SUMX('Facts Table', [Total Amount]/RELATED( 'Dimensions Table'[WORKING_DAYS] ) )
RETURN
AmtPerDay

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

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.