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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Nash2Bos
Helper I
Helper I

Adding 2 columns in a matrix table based on filters

Hello all. I'm looking to build a column to add to my table my matrix table looks like

 

division | building 1 | building 2

finance |     288.       |.    100

HR.       |      100.      |.     200

credit.   |      150.      |      300
Market |       50.        |    400

 

so the third column should be 388 for finance, 300 for HR, 450 for credit .....

 

I can't use the auto some because some people are in both buildings so the number comes in lower. What I'm looking for is a way to count those values and add them. The data is set up in one table and I'm using division for rows and building for columns and counting people. 

thank you in advance 

1 ACCEPTED SOLUTION

twofingertyper_0-1711479792630.png

It could be that my measure falls apart when there's more data involved... let me know how you get on. 

View solution in original post

8 REPLIES 8
Nash2Bos
Helper I
Helper I

No problem maybe in imputing it wrong. Once you make the function how do you make that table?

twofingertyper_0-1711479792630.png

It could be that my measure falls apart when there's more data involved... let me know how you get on. 

Thank you! I was trying to add it as a column

twofingertyper
Helper III
Helper III

So the end column would be a total for both buildings, but would not be building 1 + building 2 because there is duplicate names?

 

Could you use a DISTINCTCOUNT Measure?  

So those numbers are distinct counts but the new column is a non distinct count so the sum of the two columns 

Ah - okay, so just a normal count of everyone in each building then? So your data table is along the lines of 

 

NameDivisionBuilding
aaaHR1
bbbHR2
aaaHR2

 

etc? 

 

But then the autosum would return the wrong value in the total (2 in HR in this example) as it's only doing the DISTINCTCOUNT?

 

Would a measure like this work in place of counting the names:

 

 

 

Measure = 
SUMX (
    DISTINCT ( 'Sheet1'[Name] ),
    CALCULATE (
        SUMX (
            DISTINCT ( 'Sheet1'[Building] ),
            CALCULATE (
                DISTINCTCOUNT ( 'Sheet1'[Division] )
            )
        )
    )
)

 

 

 

 

 

I tried putting this in and it's giving a distinct count across the two. I'm looking go add the two distinct counts. For example it's desks used, someone can have a desk in both doing distinct give the amount of employees but the desk still needs to be counted twice in the total 

Sorry to hear that - I'm just working with basic data, so I did this quickly:

twofingertyper_0-1711475227415.png

Which gives:

twofingertyper_1-1711475248785.png

If you are happy to share a PBIX I'm happy to take a look further? 

 

(no guarantee that I'll figure out, still learning Power BI but enjoy the challenge of looking at others problems).

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.