The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
@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
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:
(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:
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
@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
User | Count |
---|---|
82 | |
81 | |
37 | |
34 | |
32 |
User | Count |
---|---|
96 | |
79 | |
61 | |
51 | |
51 |