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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mb0307
Responsive Resident
Responsive Resident

YTD and YTG for Sales and Forecast

Hi,

 

I have two tables, ACTUAL SALES and FORECAST.

 

Actuals sales table only show the sales data upto July in this example.  Month of July is a curent month and not completed yet::

Data.PNG 

 

Forecast table has historic and future data::

Forecast.PNG

 

So, I would like to create two measures YTD (actuals) and YTG (forecast).

 

YTD:  If Actuals Max Month-Year <> End of month then only sum previous months - example for Actuals table above YTD should only include Jan to Jun of 2020.

 

YTG:  If Actuals Max Date-Month <> End of month then use forecast data for that and future months - example for Forecat table above YTG should only include Jul to Dec of 2020.

 

is it possbile create YTD and YTG based on above critiria please?

 

Thanks 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mb0307 , Not cleat, but seem like you need a measure like

Measure = if( eomonth(date[date],0) <=eomonth(today(),-1), sum(Sales[sales]), sum(Target[Target]))

 

then you can use ytd on it

Refer: https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @mb0307 ,

 

Check this measure.

Measure =
IF (
    FORMAT ( SELECTEDVALUE ( Actuals[yearmonth] ), "YYYYMM" )
        < FORMAT ( TODAY (), "YYYYMM" ),
    CALCULATE (
        SUM ( Actuals[actual sales] ),
        FILTER (
            ALL ( Actuals ),
            FORMAT ( Actuals[yearmonth], "YYYYMM" )
                < FORMAT ( MAX ( Actuals[yearmonth] ), "YYYYMM" )
        )
    ),
    CALCULATE (
        SUM ( Forecast[actual sales] ),
        FILTER (
            ALL ( Forecast ),
            FORMAT ( Forecast[yearmonth], "YYYYMM" ) >= FORMAT ( TODAY (), "YYYYMM" )
                && FORMAT ( Forecast[yearmonth], "YYYYMM" )
                    <= FORMAT ( MAX ( Actuals[yearmonth] ), "YYYYMM" )
        )
    )
)

3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@mb0307 , Not cleat, but seem like you need a measure like

Measure = if( eomonth(date[date],0) <=eomonth(today(),-1), sum(Sales[sales]), sum(Target[Target]))

 

then you can use ytd on it

Refer: https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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