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
Anonymous
Not applicable

Simple Calculation Required - DAX formula

I have quite a simple query 

 

I've made a dashboard without having to use DAX. I've now hit a wall and through my research I think I need to use a DAX formula. I've never used this before so your help will be VERY much appreciated

 

So I created a Table using the Visualisation palette and I have a few other charts on the page that filter this table. However I do want one column in this table to remain static and this is a Unit cost value. If I were to do this on Excel, it would be using a SUMIF, and would sum all the costs in a particular column and group it by a category, for this example lets assume I'm grouping the costs by a country. Now this dashboard has a chart that filters by City, however I don't want the country Unit cost to change as I filter out these cities. What is the formula that I need to use? From my research I think it will be a combination of CALCULATE, ALL and SUM however I've have no luck with this.

 

Your speedy help with this otherwise simple question will be very much appreciated!

1 REPLY 1
Stachu
Community Champion
Community Champion

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1Column2
A1
B2.5

based on what you wrote, and assuming everything is in one table, something like this should work:

Measure = CALCULATE(SUM('Table'[Unit cost]), ALL('Table'[City]))

it negates the filters you put on the cities, so it should give the total per country



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.

Top Solution Authors