Forum Discussion
Exclude weekend from date column in Power BI
Hello,
I need to ask how I could exclude weekends from date column, leaving date only weekday.
Here is dax of date column:
- Anonymous4 years ago
Hi Analitika
Try to add a visual level filter by using a measure:
Measure = IF(MAX('Calendar'[WeekdayNo])<>6&&MAX('Calendar'[WeekdayNo])<>7,1)Set show items when the value is 1.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
12 Replies
- freginier
Solution Sage
Create calculated column and filter on blankFlag to Exclude = IF( 'Calendar'[WeekdayNo] = 7 || 'Calendar'[WeekdayNo] = 6, "X") - Samarth_18
Community Champion
HI Analitika ,
Try this:-
Calendar = VAR Dates = ADDCOLUMNS ( CALENDAR ( DATE ( MIN ( '_Year BRIDGE'[Year] ), 1, 1 ), DATE ( MAX ( '_Year BRIDGE'[Year] ), 12, 31 ) ), "Year", YEAR ( [Date] ), "MonthNo", MONTH ( [Date] ), "Month", FORMAT ( [Date], "mmm" ), "Quarter", FORMAT ( [Date], "\Qq" ), "YearQuarter", FORMAT ( [Date], "YYYY \QQ" ), "WeekdayNo", WEEKDAY ( [Date], 2 ), //1-Sun..Sat, 2-Mon..Sat "Weekday", FORMAT ( [Date], "ddd" ) ) RETURN FILTER ( Dates, NOT ( [WeekdayNo] IN { 6, 7 } ) )Thanks,
Samarth
- Analitika
Post Prodigy
I need create a new date column which will be filtered according to weekday.
- Samarth_18
Community Champion
Analitika , That code doing the same. Its filtered out the weekends and weekdays remains.
- Analitika
Post Prodigy
Yes I have created a new table but problem is that I still see gaps in visual.
- AnonymousNot applicable
Hi Analitika
Try to add a visual level filter by using a measure:
Measure = IF(MAX('Calendar'[WeekdayNo])<>6&&MAX('Calendar'[WeekdayNo])<>7,1)Set show items when the value is 1.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.