cancel
Showing results for
Did you mean:
Helper I

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

I have this matrix visual in powerbi

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,

thank you, any help is appreciated 🙂

1 ACCEPTED SOLUTION
Super User

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

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

Now create the matrix with the fields from the date and company tables and the measures to get:

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
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

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

Sample PBIX file attached

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

4 REPLIES 4
Super User

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)?

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

Helper I

It will be fixed for those 3 companies

Super User

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

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

Now create the matrix with the fields from the date and company tables and the measures to get:

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
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

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

Sample PBIX file attached

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

Helper I

thank you so much 🙂

Announcements

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors