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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ducvan1987
New Member

Calculating run rate Month To Date Base on History Last Month

Dear everbody

Please help to caculcate Runrate month to day base on history Lastmonth.

I have list seller perfomance daily . So i want calculate MTD (End of Month) how many order they can reach base on perfomance last month.

I have Grass_date / Shopid / Orders.

So what 's best metric Runrate ? please help

ducvan1987_0-1702268987894.png

 

 

1 ACCEPTED SOLUTION
v-yaningy-msft
Community Support
Community Support

Hi, @ducvan1987 

 

May I ask if this is the expected output you are looking for? Based on your description, since I'm not sure of your specific needs, I've used two methods to achieve the effect you're looking for. Following picture shows the effect of the display.

Method 1:

vyaningymsft_0-1702527801135.png

 

Measures:

LastMonthOrders =
CALCULATE ( SUM ( 'Table'[orders] ), PREVIOUSMONTH ( 'Table'[grass_date] ) )

DaysInLastMonth =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        MONTH ( 'Table'[grass_date] ) = MONTH ( EDATE ( TODAY (), -1 ) )

            && YEAR ( 'Table'[grass_date] ) = YEAR ( EDATE ( TODAY (), -1 ) )

    )

)

AvgDailyOrdersLastMonth =
DIVIDE ( [LastMonthOrders], [DaysInLastMonth] )

DaysMTD =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        'Table'[grass_date] >= DATE ( 2023, 12, 1 )

            && 'Table'[grass_date] <= TODAY ()

    )

)

MTDRunRate =
[AvgDailyOrdersLastMonth] * [DaysMTD]

 

Method 2:

vyaningymsft_1-1702527801143.png

 

 

Measures:

DaysInLastMonth =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        MONTH ( 'Table'[grass_date] ) = MONTH ( EDATE ( TODAY (), -1 ) )

            && YEAR ( 'Table'[grass_date] ) = YEAR ( EDATE ( TODAY (), -1 ) )

    )

)

LastMonthOrders =
SUMX (

    FILTER ( 'Table', MONTH ( 'Table'[grass_date] ) = MONTH ( TODAY () ) - 1 ),

    'Table'[orders]

)

AvgDailyOrdersLastMonth =
SUMX (

    FILTER ( 'Table', MONTH ( 'Table'[grass_date] ) = MONTH ( TODAY () ) - 1 ),

    'Table'[orders]

) / [DaysInLastMonth]

MTDRunRate =
[AvgDailyOrdersLastMonth] * [DaysMTD]

DaysMTD =
VAR StartDate =
    EOMONTH ( TODAY (), -1 ) + 1
VAR EndDate =
    TODAY () + 1
RETURN
    DATEDIFF ( StartDate, EndDate, DAY )

 

If this does not work, could you please share some clear sample data without sensitive information and expected output.

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-yaningy-msft
Community Support
Community Support

Hi, @ducvan1987 

 

May I ask if this is the expected output you are looking for? Based on your description, since I'm not sure of your specific needs, I've used two methods to achieve the effect you're looking for. Following picture shows the effect of the display.

Method 1:

vyaningymsft_0-1702527801135.png

 

Measures:

LastMonthOrders =
CALCULATE ( SUM ( 'Table'[orders] ), PREVIOUSMONTH ( 'Table'[grass_date] ) )

DaysInLastMonth =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        MONTH ( 'Table'[grass_date] ) = MONTH ( EDATE ( TODAY (), -1 ) )

            && YEAR ( 'Table'[grass_date] ) = YEAR ( EDATE ( TODAY (), -1 ) )

    )

)

AvgDailyOrdersLastMonth =
DIVIDE ( [LastMonthOrders], [DaysInLastMonth] )

DaysMTD =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        'Table'[grass_date] >= DATE ( 2023, 12, 1 )

            && 'Table'[grass_date] <= TODAY ()

    )

)

MTDRunRate =
[AvgDailyOrdersLastMonth] * [DaysMTD]

 

Method 2:

vyaningymsft_1-1702527801143.png

 

 

Measures:

DaysInLastMonth =
COUNTROWS (

    FILTER (

        ALL ( 'Table'[grass_date] ),

        MONTH ( 'Table'[grass_date] ) = MONTH ( EDATE ( TODAY (), -1 ) )

            && YEAR ( 'Table'[grass_date] ) = YEAR ( EDATE ( TODAY (), -1 ) )

    )

)

LastMonthOrders =
SUMX (

    FILTER ( 'Table', MONTH ( 'Table'[grass_date] ) = MONTH ( TODAY () ) - 1 ),

    'Table'[orders]

)

AvgDailyOrdersLastMonth =
SUMX (

    FILTER ( 'Table', MONTH ( 'Table'[grass_date] ) = MONTH ( TODAY () ) - 1 ),

    'Table'[orders]

) / [DaysInLastMonth]

MTDRunRate =
[AvgDailyOrdersLastMonth] * [DaysMTD]

DaysMTD =
VAR StartDate =
    EOMONTH ( TODAY (), -1 ) + 1
VAR EndDate =
    TODAY () + 1
RETURN
    DATEDIFF ( StartDate, EndDate, DAY )

 

If this does not work, could you please share some clear sample data without sensitive information and expected output.

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Vallirajap
Resolver III
Resolver III

Hii @ducvan1987 

Use the below measure to find the MTD orders

 

MTD = TOTALMTD(SUM(tablename[Orders]), tablename[grass_date])
 
its works then, Mark as a solution and hit the kudo
Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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