Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

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

  • Anonymous you can add new measure with following expression

     

    Market Sales = CALCULATE( SUM( Table[Coloumn] ), Table[City] = "Market" )
    • Anonymous's avatar
      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