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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Matrix Countrows

Hi all,

 

I am stuck with a measure creation and would really appreciate some help!

I have a tabular model with a lot of measures and need to create another one working with existing ones.

This is related to timesheets.

I have a measure [Total Hours] - hours logged by employee

measure [Standard Hours] - hours expected for the employee.

 

The new measure needs to check if total hours<standard hours * .75 and flag 1 if true. And count the true total.

I created a measure that works in a table, but when I use in a matrix with other rows the total is not counting correctly.

 

I've tested many ways and this is what I have at the moment(i just added the if because i just received a requirement to also return 1 if total hours =0):

 

var filter1 = COUNTROWS(FILTER (
'Staff Detail',
('Staff Detail'[Left Date] > TODAY() - 7 || ISBLANK('Staff Detail'[Left Date])) // check if employee is still valid for this week timesheet
&& [Total Hours]<Measures_[Standard Hours]*.75 ))

return

if([Total Hours]=0,1,filter1)

 

ian_viana_0-1683268855423.png

The matrix has 4 rows( service line- office - name - client name - description

the flag is working fine, just need to count the totals. I tried countx to change context but didn't work.

 

Thanks,

2 REPLIES 2
Mahesh0016
Super User
Super User

@Anonymous Please Share your Expected Output.

Anonymous
Not applicable

Hi @Mahesh0016, I'd like to see the count for the total rows flagged with 1 on the matrix total.

 

ian_viana_0-1683296597102.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.