cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bobmarley2010 Occasional Visitor
Occasional Visitor

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
Super User II
Super User II

Re: Simple Calculation Required - DAX formula

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 🙂

Proud to be a Datanaut!

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors