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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sustar2020
Regular Visitor

DAX help: calculate Sum by each category: not getting the right results

I am trying to calculate the total recipe cost price for each recipe. I used the below DAX formula as shown in the image and also listed below but I am not getting the correct result. I am trying to acheive this in a Power Bi Matrix visual. Please help.

Recipe Total Cost Price = Calculate(SUM('All Recipes'[Ingredient_Cost_Price]), ALLEXCEPT('All Recipes','All Recipes'[Recipe Name]))

 

PowerBi.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @sustar2020,

You can try to use the following measure formula if that is suitable for your requirement:

Recipe Total Cost Price =
CALCULATE (
    SUM ( 'All Recipes'[Ingredient_Cost_Price] ),
    ALLSELECTED ( 'All Recipes' ),
    VALUES ( 'All Recipes'[Recipe Name] )
)

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
sustar2020
Regular Visitor

Hi, sorry, it didn't work. It's giving an empty column.

Anonymous
Not applicable

HI @sustar2020,

You can try to use the following measure formula if that is suitable for your requirement:

Recipe Total Cost Price =
CALCULATE (
    SUM ( 'All Recipes'[Ingredient_Cost_Price] ),
    ALLSELECTED ( 'All Recipes' ),
    VALUES ( 'All Recipes'[Recipe Name] )
)

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@sustar2020 , if Ingredient_Cost_Price is a column this seems fine to me

 

But you can try

 

Recipe Total Cost Price = Calculate(SUM('All Recipes'[Ingredient_Cost_Price]), filter(allselected('All Recipes') ,'All Recipes'[Recipe Name] = max('All Recipes'[Recipe Name]) ))

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.