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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Oros
Post Prodigy
Post Prodigy

Count working days

Hello,
 
I am looking for a measure to count the number of days based on the selected date range in the date slicer.  Thanks.
 
I am definitely missing a filter in this measure because the result is giving me the total posted invoices instead of the total days.
 
COUNT DAYS = COUNT('POSTED INVOICE'[Posting_Date])
 
Oros_0-1710947379046.png

The selected date range above should result in 2 (days).  But is giving me a result of 5 based on this table below.

Oros_1-1710947446129.png

 

1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

@Oros  Try this measure:

Date Try =
 var _max = maxx(ALLSELECTED('financials'),'financials'[Date])
var _min = minx(ALLSELECTED('financials'),'financials'[Date])
return
datediff(_min,_max,day)+1
 
Tahreem24_0-1710948479983.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

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Ideally, you should create a Calendar Table.  Create a relationship (Many to One and Single) from the Posting Date column of the Invoice Table to the Date column of the Calendar Table.  Build the slicer from the Date column of the Calendar Table.  Write these measures:

Invoices issued = countrows(Data)

Number of days on which invoices were issues = countrows(filter(values(Calendar[date]),[Invoices issued]>0)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur,

 

Thank you for your reply.  The Invoices issued is correct but it looks like the Number of days is NOT correct.  Maybe I missed something?  Also, is that measure supposed to EXCLUDE the weekends?  Thanks again.

Oros_0-1711116920848.png

 


 

You are welcome.  The date slicer should be built from the Calenar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Tahreem24
Super User
Super User

@Oros  Try this measure:

Date Try =
 var _max = maxx(ALLSELECTED('financials'),'financials'[Date])
var _min = minx(ALLSELECTED('financials'),'financials'[Date])
return
datediff(_min,_max,day)+1
 
Tahreem24_0-1710948479983.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

Hi @Tahreem24 ,

 

Your solution is wonderful!  Thanks!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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