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
check1
Frequent Visitor

Calculation to filter/group records and only show totals

I have a matrix visual that gives me the Totals that I need for a given employee broken down by Ticket Number worked, the Hours Worked on those tickets, and the Estimated Hours for each given ticket.  The totals in this example (352.97 Hours Worked and 381.25 Estimated Hours) are correct when the visual is setup like it is below.  

check1_0-1729019762452.png


If I remove the Ticket Number the total Hours Worked remains the same and is correct, but the Estimated Hours are incorrect.  I'm assuming it's giving me the Estimated Hours for all tickets, not just the tickets worked by the selected Employee.  

check1_1-1729020001746.png

Is there a way to filter or group the Estimated Hours for just those tickets worked by the selected Employee without showing all the tickets individually by row?

4 REPLIES 4
v-xiaocliu-msft
Community Support
Community Support

Hi @check1 , 

 

Could you share the sample data and the measure you are using?

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

 

Best Regards,

Wearsky

Lucas_LP
Resolver I
Resolver I

Hi,

Try replacing the column "Estimated Hours" with the following measure (rename any columns/table or aggregation method you find necessary):

Filtered Estimated Hours =   
CALCULATE(  
    SUM('Table'[Estimated Hours]),  
    FILTER(  
        'Table',  
        'Table'[Employee] = SELECTEDVALUE('Table'[Employee]) &&   
        'Table'[Ticket Number] IN VALUES('Table'[Ticket Number])  
    )  
) 

Thanks @Lucas_LP .  One important item I neglected to mention is these values are in two different tables.  Estimated Hours and Ticket Number are in a Ticket table.  Employee is in an Employee table.  The tables are related, but when creating the measure you suggested I get a message "A single value for column 'Employee' in table 'Employee' cannot be determined.  This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.  

I've tried creating this as both a measure and a calculated column with the same error.

Could you show what the Matrix visual configuration is (which columns are in which visual fields).
And which column is the table related by (please specify relation type also, such as many to one)?
Apart from that, I doubt this is the case, but if it's not yet set so, try setting the relationship direction as "both".

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.