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
kentsharp
Regular Visitor

Count rows with conditions in matrix

Hello,

Looking for some support on counting rows in a matrix if the conditions are met. The dataset i have is field crews working on multiple jobs in a day and i want to count if that day has sumofhours over certain thresholds.  I have a measure if its <=12, but it's counthing the jobs on a day instead of it being the sumofhours on that day <=12 hours.  How might it be best to do this?

 

kentsharp_0-1677991255500.png

Thanks

Kent

8 REPLIES 8
tamerj1
Super User
Super User

Hi @kentsharp 

you may try

SUMX ( 

VALUES ( 'Table'[Date] ),

VAR SumOfHours = [SumofHours]
RETURN

IF ( SumOfHours <= 12, SumOfHours )

)

kentsharp
Regular Visitor

Thanks for the response, but i'm not entirly sure I understand what your mean.

hi @kentsharp 

i mean try to provide your sample dataset and expected result, all the others could be distracting.

I see...thanks

 

Below is the data.  The resusult i'm looking for is to count the number of days an employee has specifc hours in a day.   They can work on multiple jobs in a day.

 

time_entry_employee      Date             jobNumber  Hours

Abdel Daoud2023-02-01 0:0022-0989-110
Alex Trenchie2023-02-01 0:0022-3115-06.5
Alex Trenchie2023-02-01 0:0022-6019-05.5
Barry Ubell2023-02-01 0:0018-1202-73.5
Barry Ubell2023-02-01 0:0023-0339-06
Benoit Hupe2023-02-01 0:0023-0069-02.5
Benoit Hupe2023-02-01 0:0023-0305-04.5
Benoit Hupe2023-02-01 0:0023-0306-02
Braden Parley2023-02-01 0:0022-3730-25.5
Braden Parley2023-02-01 0:0022-3738-04
Brady Sahulka2023-02-01 0:0022-0883-29
Camara Froese2023-02-01 0:0022-2268-15.5
Camara Froese2023-02-01 0:0023-0317-06.5
Caydan Lachapelle2023-02-01 0:0021-3430-02
Caydan Lachapelle2023-02-01 0:0022-2276-23.5
Caydan Lachapelle2023-02-01 0:0022-3863-05.5

 

hi @kentsharp 

could you also provide your expected result in a table?

FreemanZ
Super User
Super User

hi @kentsharp 

focus on your expectation and orginal dataset.

kentsharp_0-1678030295986.png

 

@kentsharp 

Please try

=
SUMX (
SUMMARIZE ( 'Table', 'Table'[Name], 'Table'[Date] ),
VAR SumOfHours = [SumofHours] RETURN IF ( SumOfHours <= 12, SumOfHours )
)

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.