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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Count IF Dax Formula

Hello, I'm trying to count the number of lawyers ( distinct timekeeper ID's) that have more than 500 attorney hours.  

 

My graph below shows the count of all distinct timekeeper ID's, but I would like to create a measure that counts only the distinct timekeeper ID's when the sum of each Timekeeper Id's Atty hours are greater than 500.  Note the data has many rows with the same TK'd and various amounts of billable hours for the same TK ID.  So, I'm looking to count distinct timekeeper ID's when the aggregate sum of billable hours is greater than 500.  I'd appreciate any help!  Thanks.

 

help.PNG

1 ACCEPTED SOLUTION

@Anonymous , Try like 

countX(filter(summarize(Table[TimeKeeper ID],"_1",sum(Table[Hour])),[_1]>=500),[TimeKeeper ID])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , try

countX(values(Table[TimeKeeper ID]),if(sum(Table[Hour])>=500,[TimeKeeper ID],blank()))

countX(filter(summarize(Table[TimeKeeper ID],"_1",sum(Table[Hour])),[_1]sum(Table[Hour])),[TimeKeeper ID])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandakassuming these are two different options.  I tried the first but got the same results:

 

countX(values(Table[TimeKeeper ID]),if(sum(Table[Hour])>=500,[TimeKeeper ID],blank()))

help.PNG

 

I gotet the following error with the second formula:

 

help.PNG

 

 

@Anonymous , Try like 

countX(filter(summarize(Table[TimeKeeper ID],"_1",sum(Table[Hour])),[_1]>=500),[TimeKeeper ID])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Tahreem24
Super User
Super User

@Anonymous ,

Try the below DAX:

Unique ID = CALCULATE(DISTINCTCOUNT(Table[TimeKeeper ID]),Table[Hour]>=500)

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@Anonymous ,

I apologize, please use the corrected one:

Unique ID = CALCULATE(DISTINCTCOUNT(Table[TimeKeeper ID]),FILTER(Table,SUM(Table[Hour])>=500))

I have created the below measure as per your scenario but I put 1000000 as a threashold value instead of 500.

Capture.PNG

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

@Tahreem24 My numbers did not change b/c I believe it's filtering the entire table when sum of all timekeeper ID's hours are greater than 500.  The table has many records of the same timekeeper ID's.  i.e. one timekeeper ID for each month (or 12 records for one timekeeper in 2019).  So, I need the measure to count the distinct timekeeper ID's when the sum of hours for each timekeeper id is greater than 500.  Does that make sense?

 

Below was my attempt:

 

help.PNG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors