Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Sums calculation

Table is 

-----------------------------------------

City                   Store     Product             Price

Toronto              A             TV1                 500

Toronto              B             TV2                  550

Ottawa               C             Laptop1          600

Ottawa               D             Laptop2          650

---------------------------------------------------

 

I want to display like

 

-----------------------------------------------------------

City                   Store     Product             Price               ratio

Toronto              A             TV1                  500             500/1050

Toronto              B             TV2                  550             550/1050

Ottawa               C             Laptop1           600              600/1250

Ottawa               D             Laptop2           650              650/1250

---------------------------------------------------

 

How to create a new measure ratio to display the above picture?

 

 

 

  • Anonymous ,

    You can create 2 Calculated Columns:

    TotalPrice = CALCULATE( SUM( [Price] ),
                    ALLEXCEPT(YourTable, YourTable[City] ))
    
    Ratio = [Price] & "/" & [TotalPrice]

    Hope this is what you are looking for.

    Regards,

2 Replies

  • rsbin's avatar
    rsbin
    Community Champion

    Anonymous ,

    You can create 2 Calculated Columns:

    TotalPrice = CALCULATE( SUM( [Price] ),
                    ALLEXCEPT(YourTable, YourTable[City] ))
    
    Ratio = [Price] & "/" & [TotalPrice]

    Hope this is what you are looking for.

    Regards,

    • Anonymous's avatar
      Anonymous
      Not applicable

      rsbin , Thank you for your help. 

       ALLEXCEPT(YourTable, YourTable[City] )

      means only use city filter.

       

      I have a further question. I will post it in this forum.