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
jpt1228
Responsive Resident
Responsive Resident

Division of columns from separate tables Best Practice

Hello, trouble shooting "related" calculation. I want to calculate the number of pallets needed to store products based on the number of cases  that fit on a pallet. I have a DimProduct that has the number of cases of product that fit on a pallet DimProduct [Cases Per Pallet] and I have a seperate table FactForecast that has the number of cases forecasted for a particular time period. When I try to create a measure such as Pallets Needed = Divide (FactForecast, FactForecast [Forecast Cases] , DimProduct [Cases Per Pallet]) PBI will not let me calculate across the tables.

 

I have found a solution but I don't know if it is the correct one from a best practice. I have created a measure called: Cases per pallet = SUM(DimProduct[Cases Per Pallet]) and Forecast Cases Helper = SUM(FactForecast[Forecast Cases]) Then I use that in the formula Forecast Pallets = DIVIDE([Forecast Cases Helper], FactForecast[Cases per pallet])

 

image.png

 

I have used 'Related' in another formula for something different but for some reason I get an error when trying to do this.

 

Thanks

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@jpt1228,

 

You may refer to the following DAX that adds a measure.

Forecast Pallets =
CEILING (
    DIVIDE (
        SUM ( FactForecast[Forecast Cases] ),
        MAXX ( FactForecast, RELATED ( DimProduct[Cases Per Pallet] ) )
    ),
    1
)
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.

View solution in original post

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

@jpt1228,

 

You may refer to the following DAX that adds a measure.

Forecast Pallets =
CEILING (
    DIVIDE (
        SUM ( FactForecast[Forecast Cases] ),
        MAXX ( FactForecast, RELATED ( DimProduct[Cases Per Pallet] ) )
    ),
    1
)
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.

@v-chuncz-msft

 

This works, thanks - It looks like I cannot just divide columns and use related - Have to use SUM(Table[Column]) as opposed to just Divide (Table[Column]). that must be why I couldn't bring in a related column.

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.