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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Help for a complex calculated column

Hi, i'm new in PowerBI and DAX.

In my dataset I have combinations of the following fields:

Country, City, Sales

 

I have a false city called 'Market'. I would like to calculate the market amount of sales by line. 

 

I wish to obtain 

Country, City, Sales, Sales Market

 

Where "Sales Market" is correspond the sales for the market in the city 

IN SQL the result could be something like:

 

SELECT t1.country, t1.city, t1.sales, sum(t2.sales as salesMarket)

FROM table t1

INNER JOIN table t2

ON t1.country = t2.country

AND t2.city = 'Market'

 

Thks for your help

 

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous you can add new measure with following expression

 

Market Sales = CALCULATE( SUM( Table[Coloumn] ), Table[City] = "Market" )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

It is not a solution. If a apply this I'll get the sum of all Market lines. I want to get the Market for the same country.

 

Example:

France Market 10000

France Paris 5000

Germany Market 20000

Germany Berlin 5000

 

I want this result:

France Market 10000 10000

France Paris     5000   10000

Germany Market 20000 20000

Germany Berlin 5000  20000

 

thks for your time anyway

 

@Anonymous I assumed you have relationship between you tables and it would work. Seems like you just showed one table in your original post. It help if you provide sample data and how your data model is. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I have only one table

@Anonymous share sample data in excel.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.