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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

matrix total row based on sum of rows of a different column

Hi ,

 

I have a matrix that looks like below :

employee

8/31/2020

9/1/2020

9/2/2020

9/3/2020

9/4/2020

John

Open

Open

Open

Abc Solutions

Open

Beth

Open

Open

Omega technologies 

 

Open

Open

Mary

Open

Open

Open

Open

Horizon solutions

 

I have a scheduledhours column measure that contains hours for every employee on a certain date.

 

I want to sum all the scheduled hours for a date and show it below like this in a matrix:

 

employee

8/31/2020

9/1/2020

9/2/2020

9/3/2020

9/4/2020

John

Open

Open

Open

Abc Solutions

Open

Beth

Open

Open

Omega technologies 

 

Open

Open

Mary

Open

Open

Open

Open

Horizon solutions

 

 

 

 

 

 

 

 

 

 

 

 

Total hours

Sum(scheduledhours)

Sum(scheduledhours

Sum(scheduledhours

Sum(scheduledhours

Sum(scheduledhours

      

 

 

How can I do this ? Any suggestions are appreciated.

1 ACCEPTED SOLUTION

Hi @Anonymous 

Build a table like yours to have a test.

1.png

I use Hasonevalue function like 

 

Measure = 
IF (
    HASONEVALUE ( 'Table'[Employee] ),
    MAX ( 'Table'[Status] ),
    SUMX (
        FILTER ( 'Table', 'Table'[Date] = MAX ( 'Table'[Date] ) ),
        'Table'[Scheduledhour]
    )
)

 

Result:

3.png

You can download the pbix file from this link: matrix total row based on sum of rows of a different column

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , I do not see any scheduled hour here. Is the first table is matrix visual or your raw data. If it is raw data you need unpivot.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

@amitchandakthe first table is a matrix visual. I want to add a row at the end to show total sum of hours for every date column. I have a column called "ScheduledHours" added in the table but it is not added to the matrix visual.

Hi @Anonymous 

Build a table like yours to have a test.

1.png

I use Hasonevalue function like 

 

Measure = 
IF (
    HASONEVALUE ( 'Table'[Employee] ),
    MAX ( 'Table'[Status] ),
    SUMX (
        FILTER ( 'Table', 'Table'[Date] = MAX ( 'Table'[Date] ) ),
        'Table'[Scheduledhour]
    )
)

 

Result:

3.png

You can download the pbix file from this link: matrix total row based on sum of rows of a different column

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Anonymous
Not applicable

Thanks @v-rzhou-msft - will try and get back to you.

Hi @Anonymous 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

lbendlin
Super User
Super User

In your measure use 

 

HASONEVALUE(table[Employee])

 

to distinguish between the individual appointments and the column totals.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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