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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to get the MTD Sales average (include all days' sales) but dividing by only business days.

I need to calculate the MTD Sales average per working days, but including in the calculation all sales (weekdays and weekends).

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

It's easier to calculate MTD with DAX. Here's a solution using DAX.

1.Create a calendar table and create a relationship with the main table.

Calendar = 
ADDCOLUMNS (
    CALENDAR ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ) ),
    "Weekday/Weekend", IF ( WEEKDAY ( [Date], 2 ) <= 5, "Weekday", "Weekend" )
)

vstephenmsft_1-1648533452238.png

 

2.Create two measures. The first one is to get the MTD sales and the second one is to get the number of weekdays.

MTD Sales = TOTALMTD(SUM('Table'[Sales]),'Table'[Date])
MTD Weekdays Count = 
TOTALMTD (
    CALCULATE (
        COUNT ( 'Calendar'[Date] ),
        FILTER ( 'Calendar', [Weekday/Weekend] = "Weekday" )
    ),
    'Calendar'[Date]
)

 

3.We have the sales and the number of working days, and we just need to divide to get the average.

Average = DIVIDE([MTD Sales],[MTD Weekdays Count])

 

Here's the result.

vstephenmsft_2-1648533623425.png

 

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.

 

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

It's easier to calculate MTD with DAX. Here's a solution using DAX.

1.Create a calendar table and create a relationship with the main table.

Calendar = 
ADDCOLUMNS (
    CALENDAR ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ) ),
    "Weekday/Weekend", IF ( WEEKDAY ( [Date], 2 ) <= 5, "Weekday", "Weekend" )
)

vstephenmsft_1-1648533452238.png

 

2.Create two measures. The first one is to get the MTD sales and the second one is to get the number of weekdays.

MTD Sales = TOTALMTD(SUM('Table'[Sales]),'Table'[Date])
MTD Weekdays Count = 
TOTALMTD (
    CALCULATE (
        COUNT ( 'Calendar'[Date] ),
        FILTER ( 'Calendar', [Weekday/Weekend] = "Weekday" )
    ),
    'Calendar'[Date]
)

 

3.We have the sales and the number of working days, and we just need to divide to get the average.

Average = DIVIDE([MTD Sales],[MTD Weekdays Count])

 

Here's the result.

vstephenmsft_2-1648533623425.png

 

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.

 

 

 

 

Vijay_A_Verma
Super User
Super User

We need to see your data. Also do you need a Power Query solution or DAX solution.

How to Get your Question Answered Quickly - https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.