Forum Discussion
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
- parry2kSuper User
Anonymous you can add new measure with following expression
Market Sales = CALCULATE( SUM( Table[Coloumn] ), Table[City] = "Market" )
- AnonymousNot 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
- parry2kSuper User
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