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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors