Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sum 2 columns in matrix table

Hi is it posible to sum 2 columns from 14 in matrix view as a extra column in the same view.

 

This is list of person nad summary work time for certain topics i need in this matrix extra sum of time spend on 2 topix together.

 

I want to add 1 extra column to this matrix with number 15 and the valu for this column will be sum of col 3 and 4.

  • It's possible but not simple. The problem is that you currently have one measure (llosc_dni) computed against two dimensions (Nazwisko_imie and Title) but you want to add a new measure that acts as an extra Title dimension value. Measures get evaluated in the context generated by the dimensions you put on the rows and columns, which is why if you add a new measure, it shows up under each number 1-14.

     

    To do what you want, there are two approaches I can think of:

    1. Remove the Title dimension from columns and create separate measures for each number you want to show.
    2. Alter the existing table or create a new table to use as your header that includes 15 and define a measure that switches calculations accordingly.

    Here's an example of the second approach for a similar but more complex situation:

    https://stackoverflow.com/questions/52632713/custom-aggregate-column-in-power-bi-matrix

9 Replies

  • It's possible but not simple. The problem is that you currently have one measure (llosc_dni) computed against two dimensions (Nazwisko_imie and Title) but you want to add a new measure that acts as an extra Title dimension value. Measures get evaluated in the context generated by the dimensions you put on the rows and columns, which is why if you add a new measure, it shows up under each number 1-14.

     

    To do what you want, there are two approaches I can think of:

    1. Remove the Title dimension from columns and create separate measures for each number you want to show.
    2. Alter the existing table or create a new table to use as your header that includes 15 and define a measure that switches calculations accordingly.

    Here's an example of the second approach for a similar but more complex situation:

    https://stackoverflow.com/questions/52632713/custom-aggregate-column-in-power-bi-matrix

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much. You saved me.

  • Anonymous  Kindly share the Column name you want to add? Or simply share the screen shot like below:

     

    • Anonymous's avatar
      Anonymous
      Not applicable

       

      • Tahreem24's avatar
        Tahreem24
        Icon for Super User rankSuper User

        Anonymous  Try this:

         = Calculate(SUM(Ilosc_dni),Title IN {3,4})

        OR

        = CALCULATE(SUM(Ilosc_dni), Title=3 || Title =4)