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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Garbo62
Resolver I
Resolver I

How to add a calculated value a row in a Power BI Matrix

Hi

I have a matrix and I want to bring in a sum of distinct location from an other table

i.e.  I want to return that there is 5 cubes listed in a Location tables (in the colume called Column)

The line between the tables is Location UID in which Location UID is unique and contains the location type

I have a measure to count DISTINCT location but you can’t add a measure to a row in a Power BI matric, any easy work around

Garbo62_0-1724321625997.png

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Garbo62 ,

Create a Calculated Column:
Go to the Data view in Power BI.
Select the table where you want to add the calculated column.
Click on New Column and enter the following DAX formula to count the distinct locations:
DAX
DistinctLocationCount =
CALCULATE(
DISTINCTCOUNT(Location[Location UID]),
ALLEXCEPT(Location, Location[Location Type])
)
This formula calculates the distinct count of Location UID for each Location Type.

Use the Calculated Column in Your Matrix:
Go to the Report view.
Add a matrix visual to your report.
Drag the Location Type to the rows of the matrix.
Drag the DistinctLocationCount calculated column to the values of the matrix.
This way, you will have a matrix that shows the count of distinct locations for each location type.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
Garbo62
Resolver I
Resolver I

Brillent Thanks works a treat.

bhanu_gautam
Super User
Super User

@Garbo62 ,

Create a Calculated Column:
Go to the Data view in Power BI.
Select the table where you want to add the calculated column.
Click on New Column and enter the following DAX formula to count the distinct locations:
DAX
DistinctLocationCount =
CALCULATE(
DISTINCTCOUNT(Location[Location UID]),
ALLEXCEPT(Location, Location[Location Type])
)
This formula calculates the distinct count of Location UID for each Location Type.

Use the Calculated Column in Your Matrix:
Go to the Report view.
Add a matrix visual to your report.
Drag the Location Type to the rows of the matrix.
Drag the DistinctLocationCount calculated column to the values of the matrix.
This way, you will have a matrix that shows the count of distinct locations for each location type.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.