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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
olegkazanskyi
Helper II
Helper II

Getting Item Components Amount Based on Sales

 

I have a simple data model of pizza sales with three tables:

1. Fact_Sales

2. DIM_Product

3. DIM_Ingridients

olegkazanskyi_2-1689629366214.png

 

Every Pizza has a specific amount of ingredients.

I would like to know how many ingredients I use per month based on sales of pizzas.

Sorry, I can't get how to build this calculation.

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Ingredient Usage =
SUMX (
    'DIM_Ingredients',
    VAR Sales =
        SUMX ( RELATEDTABLE ( 'FACT_Sales' ), 'FACT_Sales'[quantity] )
    VAR Result = Sales * 'DIM_Ingredients'[Usage, KG]
    RETURN
        Result
)

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Try

Ingredient Usage =
SUMX (
    'DIM_Ingredients',
    VAR Sales =
        SUMX ( RELATEDTABLE ( 'FACT_Sales' ), 'FACT_Sales'[quantity] )
    VAR Result = Sales * 'DIM_Ingredients'[Usage, KG]
    RETURN
        Result
)

Unfortunately, I got blank values as a result.
I'm sharing a dataset just for any case.
Link

The relationship between sales and product is invalid - the keys in the product table include the size whereas the sales table doesn't.

Thank you! You're a life saviour.
A silly mistake

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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