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
Anonymous
Not applicable

Dax measure to calculate Sales by working day with relation to MTD sales

I want to be able to prepare a report to calculate the forecasted/Targeted sales by workday in a month and compare it to actual. Let say we have 23 workdays in a month, and forecasted sales is $20,000, and today is workday 4, the forecasted sales MTD would be 20,000/23x4. Please how do I go about this?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file. In the sample, I define Saturday and Sunday as non working day.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_1-1699898806602.png

 

Jihwan_Kim_0-1699898794028.png

 

Forecast MTD: =
VAR _monthlyforecast =
    CALCULATE (
        SUM ( Forecast[Forecast Sales] ),
        ALL ( 'Calendar'[Date] ),
        VALUES ( 'Calendar'[Year-Month sort] )
    )
VAR _monthworkdayscount =
    COUNTROWS (
        FILTER (
            ALL ( 'Calendar' ),
            NOT ( 'Calendar'[Day number] IN { 1, 7 } )
                && 'Calendar'[Year-Month sort] = MAX ( 'Calendar'[Year-Month sort] )
        )
    )
VAR _uptotoday =
    COUNTROWS (
        FILTER (
            ALL ( 'Calendar' ),
            NOT ( 'Calendar'[Day number] IN { 1, 7 } )
                && 'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
                && 'Calendar'[Year-Month sort] = MAX ( 'Calendar'[Year-Month sort] )
        )
    )
RETURN
    DIVIDE ( _monthlyforecast, _monthworkdayscount ) * _uptotoday

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file. In the sample, I define Saturday and Sunday as non working day.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_1-1699898806602.png

 

Jihwan_Kim_0-1699898794028.png

 

Forecast MTD: =
VAR _monthlyforecast =
    CALCULATE (
        SUM ( Forecast[Forecast Sales] ),
        ALL ( 'Calendar'[Date] ),
        VALUES ( 'Calendar'[Year-Month sort] )
    )
VAR _monthworkdayscount =
    COUNTROWS (
        FILTER (
            ALL ( 'Calendar' ),
            NOT ( 'Calendar'[Day number] IN { 1, 7 } )
                && 'Calendar'[Year-Month sort] = MAX ( 'Calendar'[Year-Month sort] )
        )
    )
VAR _uptotoday =
    COUNTROWS (
        FILTER (
            ALL ( 'Calendar' ),
            NOT ( 'Calendar'[Day number] IN { 1, 7 } )
                && 'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
                && 'Calendar'[Year-Month sort] = MAX ( 'Calendar'[Year-Month sort] )
        )
    )
RETURN
    DIVIDE ( _monthlyforecast, _monthworkdayscount ) * _uptotoday

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.