Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Evanooruvan
Helper II
Helper II

Combine 3 rows in matrix as extra row and calculate values in matrix visual

I have this matrix visual in powerbi

Evanooruvan_0-1669196962496.png

Now i want to add a extra row in matrix visual combining bxx,exx,fxx ( named as BEF) 
How to calculate values like below visual in powerbi matrix,

Evanooruvan_1-1669197179906.png

 

thank you, any help is appreciated 🙂

 

1 ACCEPTED SOLUTION

The easiest way is to create a new group with the companies as follows. First the model

model.jpg

In the company table, create a new group as follows:

Group.gif

grouped table.jpgNow create the matrix with the fields from the date and company tables and the measures to get:

matrix.jpg

Another alternative is to create the company table using:

 

Company with groups =
VAR _BEF =
    CALCULATETABLE (
        VALUES ( fTable[Company] ),
        FILTER (
            fTable,
            CONTAINSSTRING ( fTable[Company], "B" )
                || CONTAINSSTRING ( fTable[Company], "E" )
                || CONTAINSSTRING ( fTable[Company], "F" )
        )
    )
VAR _ROWS =
    DISTINCTCOUNT ( fTable[Company] )
RETURN
    ADDCOLUMNS (
        DISTINCT ( fTable[Company] ),
        "BEF",
            IF (
                fTable[Company] IN _BEF,
                CONCATENATEX ( _BEF, fTable[Company], " & " ),
                fTable[Company]
            ),
        "Order",
            IF (
                fTable[Company] IN _BEF,
                _ROWS + 1,
                RANKX ( ALL ( fTable[Company] ), fTable[Company],, ASC )
            )
    )

 

and then set up the matrix as follows

matrix 2.jpg

 

If you want to create the visual exactly as you posted it can be done (let us know).

Sample PBIX file attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

Is the new rows supposed to be bynamic (you intend to select the companies in a slicer for example) or will it be a fixed number of companies (always the same)?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






It will be fixed for those 3 companies

The easiest way is to create a new group with the companies as follows. First the model

model.jpg

In the company table, create a new group as follows:

Group.gif

grouped table.jpgNow create the matrix with the fields from the date and company tables and the measures to get:

matrix.jpg

Another alternative is to create the company table using:

 

Company with groups =
VAR _BEF =
    CALCULATETABLE (
        VALUES ( fTable[Company] ),
        FILTER (
            fTable,
            CONTAINSSTRING ( fTable[Company], "B" )
                || CONTAINSSTRING ( fTable[Company], "E" )
                || CONTAINSSTRING ( fTable[Company], "F" )
        )
    )
VAR _ROWS =
    DISTINCTCOUNT ( fTable[Company] )
RETURN
    ADDCOLUMNS (
        DISTINCT ( fTable[Company] ),
        "BEF",
            IF (
                fTable[Company] IN _BEF,
                CONCATENATEX ( _BEF, fTable[Company], " & " ),
                fTable[Company]
            ),
        "Order",
            IF (
                fTable[Company] IN _BEF,
                _ROWS + 1,
                RANKX ( ALL ( fTable[Company] ), fTable[Company],, ASC )
            )
    )

 

and then set up the matrix as follows

matrix 2.jpg

 

If you want to create the visual exactly as you posted it can be done (let us know).

Sample PBIX file attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






thank you so much 🙂

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.