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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors