Forum Discussion

shbz1690's avatar
shbz1690
Frequent Visitor
5 years ago
Solved

How to add a column in your matrix

I have a table with 2 columns:  carCount , carDealer

 

carDealer carCounttype
A2sedan
B3coupe
A2sport
A3coupe
B2sedan
B5sport
C6coupe
C4sedan
A2sedan
B4sport
C6coupe
C10sport

 

I created a matrix i power BI, where I want total count of car by type for each dealership. So the result was like this:

 

carDealersedancoupesportTotal
A4329
B23914
C4121026

 

I am able to do this, but I want to add one more column which should be: (coupe+sport/Total)*100

 

How can I add this column here in the matrix.

 

  • Hi, shbz1690 

    Thank you for your feedback.

    I did this by using Tabular Editor in Power BI. 

    I was thinking about how to show it like what you described on the post, but I could only find this way to do it. I think there are many other ways to achieve this but in my case, I could do it in this way only.

    First, download the external tool (Tabular Editor) for Power BI, and install it.

    In Tabular Editor, 

    - create a calculation group

    - under the calculation group, create calculation items

         item1: Sedan

         item2: Coupe

         item3: Sport

         item4: OneMoreColumn

         item5: Total

     

    I wrote the DAX measure for each calculation item. Keep in mind that the Total also has to be created.

     

    I could not find a way to draw pictures for each step.

     

    If you are OK, I can show it to you via TEAMS meeting.

     

    Thank you very much.

4 Replies

  • Hi, shbz1690 

    Please correct me if I wrongly understood your question.

    Please check whether the below picture is what you are looking for.

     

     

    I have created a Calculation group by using Tabular Editor in Power BI, and add this Calculation Group-Column to the Column-section in matrix visualization.

    The link to the sample pbix file is down below.

     

    https://www.dropbox.com/s/7jgpbcnwcsyavxo/shbz1690.pbix?dl=0 

     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster.

    • shbz1690's avatar
      shbz1690
      Frequent Visitor

      What you did is correct, can you please let me know the steps so that I can do it in my power BI file.

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

        Hi, shbz1690 

        Thank you for your feedback.

        I did this by using Tabular Editor in Power BI. 

        I was thinking about how to show it like what you described on the post, but I could only find this way to do it. I think there are many other ways to achieve this but in my case, I could do it in this way only.

        First, download the external tool (Tabular Editor) for Power BI, and install it.

        In Tabular Editor, 

        - create a calculation group

        - under the calculation group, create calculation items

             item1: Sedan

             item2: Coupe

             item3: Sport

             item4: OneMoreColumn

             item5: Total

         

        I wrote the DAX measure for each calculation item. Keep in mind that the Total also has to be created.

         

        I could not find a way to draw pictures for each step.

         

        If you are OK, I can show it to you via TEAMS meeting.

         

        Thank you very much.