Forum Discussion

Naveen29's avatar
Naveen29
Helper II
2 years ago
Solved

DAX help needed

My current matrix table in the PowerBI showing like table A: Dont want to change M query ,table relationships etc. I just need simple DAX which converts the Region values to Negative , and sum should (Region1+Region2+region3)- Region as shown in table B.

 

this is just sample data , we have number of regions in the data

Table A:

 

to table B

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Naveen29 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create two measures. 

    Measure = IF(MAX('Table'[Region])="Region",-SUM('Table'[Value]),SUM('Table'[Value]))
    Measure 2 = SUMX(VALUES('Table'[Region]),[Measure])

    (3) Then the result is as follows.

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

  • You can create Calculated column for that 

    Negative Sales = IF('Summerized table'[Country] = "Mexico",  0 -'Summerized table'[ Sales],'Summerized table'[ Sales])
     

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Naveen29 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create two measures. 

    Measure = IF(MAX('Table'[Region])="Region",-SUM('Table'[Value]),SUM('Table'[Value]))
    Measure 2 = SUMX(VALUES('Table'[Region]),[Measure])

    (3) Then the result is as follows.

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

  • Aditya062's avatar
    Aditya062
    Frequent Visitor

    You can create Calculated column for that 

    Negative Sales = IF('Summerized table'[Country] = "Mexico",  0 -'Summerized table'[ Sales],'Summerized table'[ Sales])