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
Gopinath_iyer
Helper II
Helper II

calculate networkdays basis user selection in between slicer

Hi All,

 

I have created a date table and used that column as between slicer, now i want to calculate weekdays between the dates selected in  this slicer.

 

regards,

Gopi

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Gopinath_iyer , Try a measure like

 


new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return

networkdats(_min, _max,1)

 

refer : https://amitchandak.medium.com/power-bi-dax-function-networkdays-5c8e4aca38c

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

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi, @Gopinath_iyer 

According to your description, yu want to calculate the number of working days between the days filtered by the slicer. Right?

Here are the steps you can follow:

(1)This is my test data:

vyueyunzhmsft_0-1663118349039.jpeg

 

(2)We can put the [Date] field in the slice and we can click “New measure” to create a measure : “days”

days =
VAR _max_date =
    MAX ( 'Table'[Date] )
VAR _min_date =
    MIN ( 'Table'[Date] )
VAR _date_table =
    ADDCOLUMNS (
        CALENDAR ( _min_date, _max_date ),
        "weekday", WEEKDAY ( [Date], 2 )
    )
RETURN
    COUNTROWS ( FILTER ( _date_table, NOT [weekday] IN { 6, 7 } ) )

 

(3)Then we can meet your need ,the result is as follows:

vyueyunzhmsft_1-1663118349040.jpeg

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Gopinath_iyer , Try a measure like

 


new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return

networkdats(_min, _max,1)

 

refer : https://amitchandak.medium.com/power-bi-dax-function-networkdays-5c8e4aca38c

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

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.