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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.