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
ThomasBachmann
Frequent Visitor

Matching food cost with sales

We update our food / production cost every month based on the price of supply.

In one report our need to match the cost of a menu item with the appropriate food cost.

 

Example:

In January I sell 1 taco at $10 a piece, my food cost that month is $1, thereby I have a margin of $9.

In February I sell 1 taco at $10 a piece, my food cost that month is $2, thereby I have a margin of $8.

 

My data looks like this:

 

SALES     
ProductProduct IDTimestampPriceAmountTotal
Taco10009705/02/2019 10.33           20,00 kr.3           60,00 kr.
Burrito10009805/02/2019 10.45         100,00 kr.1         100,00 kr.
Salad10009905/02/2019 10.55           95,00 kr.2         190,00 kr.

 

FOOD COST   
ProductProduct IDCost CaluclationFood Cost
Taco10009701/02/2019           20,00 kr.
Burrito10009801/02/2019         100,00 kr.
Salad10009901/02/2019           95,00 kr.

 

How do I match the sales with the food cost with the food cost from the appropriate month?

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @ThomasBachmann

 

You can try this for a 'MonthPrice' calculated column in your table SALES:

 

 

MonthPrice =
CALCULATE (
    DISTINCT ( 'FOOD COST'[Food Cost] ),
    FILTER (
        'FOOD COST',
        'FOOD COST'[Product ID] = SALES[Product ID]
            && MONTH ( 'FOOD COST'[Cost Caluclation] ) = MONTH ( SALES[Timestamp] )
            && YEAR ( 'FOOD COST'[Cost Caluclation] ) = YEAR ( SALES[Timestamp] )
    )
)

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @ThomasBachmann

 

You can try this for a 'MonthPrice' calculated column in your table SALES:

 

 

MonthPrice =
CALCULATE (
    DISTINCT ( 'FOOD COST'[Food Cost] ),
    FILTER (
        'FOOD COST',
        'FOOD COST'[Product ID] = SALES[Product ID]
            && MONTH ( 'FOOD COST'[Cost Caluclation] ) = MONTH ( SALES[Timestamp] )
            && YEAR ( 'FOOD COST'[Cost Caluclation] ) = YEAR ( SALES[Timestamp] )
    )
)

 

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.