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
baneworth
Helper III
Helper III

Weekday filtering in DAX

Dear All,

 

after checking the forum for hours i give up, i couldn't find the solution to my problem.

If anyone could be so kind and take a look at my problem.

 

I have a Column with dates when employees booked their activity, i then created the total and avg from employees booked by day (see table botttom left for avg by month & bottom right by day)

I now have to repeat the same to get avg by month without weekends.

 

HCAPP.jpg

 

RFT = Employee (RFT is a measure)

 

Formula for average in table on left (this includes all days)

RFTavg = AVERAGEX(VALUES(vwPassdownNew[Work_Day]),[RFT])

 

What would be DAX excluding weekends?

 

Best regards

3 REPLIES 3
AllisonKennedy
Super User
Super User

@baneworth , do you have a DimDate table? If you have a good Dates table with a Weekday column, which specifies whether it's a weekend or not, then this is easy.

 

My date table (you'll need to add the Weekday column, can use @amitchandak 's solution: Week_Day = if(WEEKNUM([Date],2)>=6,0,1) to add the Weekday column.

https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

Radacad date table (I think it has weekday already from memory, but not sure):

https://radacad.com/all-in-one-script-to-create-date-dimension-in-power-bi-using-power-query

 

Then do: 

 

RFTweekdayAvg =  AVERAGEX(DimDate[Week_Day]),[RFT])

 

Note I don't need the VALUES() function here because I'm using a Dim date table rather than the fact table: 

https://excelwithallison.blogspot.com/2020/08/its-complicated-relationships-in-power.html

 

 

 

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@baneworth , Try like

measure

RFTavg = calculate(AVERAGEX(VALUES(vwPassdownNew[Date]),[RFT]), filter(vwPassdownNew,vwPassdownNew [Work_Day] =1))

 

 

where column

Work_Day = if(WEEKNUM([Date],2)>=6,0,1)

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

Dear @amitchandak 

 

Thank you for quick reply.

 

I have 2 Questions

1. What do you refer to as "vwPassdownNew[Date]"?  I do not have such as of now.

2. my Work_Day is a column created by SQL Datasource. Therefore i can not change as you recommended. What can i do instead? Or did you mean a new measure?

 

workday.jpg

 

Best regards

Matthias

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.

Top Solution Authors
Top Kudoed Authors