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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Sum values in matrix that is higher than x

Good day

 

I'm new to PBI and trying to replicate an excel report on to PBI. 

I managed to replicate most information but now I'm stuck on one value I want to display. I searched this forum and there is something similar but not completely what I'm looking for. Unless I didn't look hard enough and can be pointed in the right direction. 

 

I have a matrix that is displaying average values per hour per day. I have a date slicer whereby the user can filter on a specific date. When the (average) value is equal to 1 or more I have a conditional format in the matrix to highlight it. But now I'm looking for a way to sum only those values to get to a total. 

For example below all the branches would have a total of zero but the Centurion Lifestyle Centre must have a total of 4.5

In excel it was easy with a SumIF.

LURSA_0-1653920040821.png

The reason why I'm using averages is because of the raw data. The data is provided per 15-minute interval and there are different queues. There are 8 rows of data per hour and an average is then required.

Below is sample data for one day for Centurion Lifestyle Centre.

The column that is used for the average on the matrix is called "Staff Over/Short"

I removed some hours as the post exceeded the character limit.

 

DateWeekDayHourStaff Over/ShortQ Namebranch code
2022/05/3123Tuesday80Deposit & Enquire2287
2022/05/3123Tuesday80Deposit & Enquire2287
2022/05/3123Tuesday80Deposit & Enquire2287
2022/05/3123Tuesday80Deposit & Enquire2287
2022/05/3123Tuesday83One to One2287
2022/05/3123Tuesday83One to One2287
2022/05/3123Tuesday84One to One2287
2022/05/3123Tuesday84One to One2287
2022/05/3123Tuesday150Deposit & Enquire2287
2022/05/3123Tuesday150Deposit & Enquire2287
2022/05/3123Tuesday150Deposit & Enquire2287
2022/05/3123Tuesday150Deposit & Enquire2287
2022/05/3123Tuesday152One to One2287
2022/05/3123Tuesday153One to One2287
2022/05/3123Tuesday152One to One2287
2022/05/3123Tuesday153One to One2287
2022/05/3123Tuesday160Deposit & Enquire2287
2022/05/3123Tuesday160Deposit & Enquire2287
2022/05/3123Tuesday160Deposit & Enquire2287
2022/05/3123Tuesday160Deposit & Enquire2287
2022/05/3123Tuesday163One to One2287
2022/05/3123Tuesday163One to One2287
2022/05/3123Tuesday163One to One2287
2022/05/3123Tuesday163One to One2287

 

Thank you for your time.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

According to the data you provided you can try the following methods.

Measure:

 

Average = 
CALCULATE (
    AVERAGE ( 'Table'[Staff Over/Short] ),
    FILTER (
        ALL ( 'Table' ),
        [Hour] = SELECTEDVALUE ( 'Table'[Hour] )
            && [Q Name] = SELECTEDVALUE ( 'Table'[Q Name] )
    )
)
Color = IF([Average]>=1,"Green",BLANK())

 

By putting the Color measure into the conditional format of the average, you can highlight the values greater than or equal to 1.

vzhangti_1-1654138595733.png

Sum = 
SUMX (
    FILTER (
        SUMMARIZE ( 'Table', 'Table'[Q Name], 'Table'[Hour], "Aver", [Average] ),
        [Aver] >= 1
    ),
    [Aver]
)

vzhangti_0-1654149713331.png

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

According to the data you provided you can try the following methods.

Measure:

 

Average = 
CALCULATE (
    AVERAGE ( 'Table'[Staff Over/Short] ),
    FILTER (
        ALL ( 'Table' ),
        [Hour] = SELECTEDVALUE ( 'Table'[Hour] )
            && [Q Name] = SELECTEDVALUE ( 'Table'[Q Name] )
    )
)
Color = IF([Average]>=1,"Green",BLANK())

 

By putting the Color measure into the conditional format of the average, you can highlight the values greater than or equal to 1.

vzhangti_1-1654138595733.png

Sum = 
SUMX (
    FILTER (
        SUMMARIZE ( 'Table', 'Table'[Q Name], 'Table'[Hour], "Aver", [Average] ),
        [Aver] >= 1
    ),
    [Aver]
)

vzhangti_0-1654149713331.png

 

Best Regards,

Community Support Team _Charlotte

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

 

Anonymous
Not applicable

Thank you very much @v-zhangti!

I learned a lot today and your solution is spot on!

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.