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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
userdata
Helper IV
Helper IV

Get the latest value based on date slicer and then calculate that for forecast

Hi,

 

so there are the actuals the ytd actuals based on the date that the user selects. Then the forecast is what for the months that are in the future. I want to be able to create a column in power bi with the red line (difference of new column based on previous column.

I want to be able to only show the last ytd value for the date that is selected. In this case it is 95 and use that as a starting point to do that 95 - what is in forecast and then the output of that - next column. So meaning , I want to calculate 95 which is last ytd where there is data and then do that minus 12 what is in forecast which gives 83, and then do that output 83 -14 (which is the forecast the next month) which gives 69 and that minus the following month data in forecast etc. I tried this several times in Dax but it didn't work. 

Any ideas how to get the red column?

 

userdata_0-1630537314159.png

 

2 REPLIES 2
userdata
Helper IV
Helper IV

Hi @amitchandak ,

 

thanks so much for your quick help! You are a hero!

 

There is just one thing I have to do here, your measure does give ytd of all the previous months and the right variance but how do I get rid of the previous months and only show from the yellow, basically just show the latest value of ytd actuals and don't show the previous months ytd in the measure? Thanks so much!

userdata_1-1630563133442.png

 

 

amitchandak
Super User
Super User

@userdata , if actual and forecast are in different table , using date table

 


Measure =
var _max =maxx(allselected(Table), Table[Date])
return
if(Date[Date] >=_max , calculate(sum(Table[Actual]) - sum(Forecast[Forecast]), datesytd(Date[Date])))

 

In same table 


Measure =
var _max =maxx(filter(allselected(Table), not(isblank(Table[Actual]))) , Table[Date])
return
if(Date[Date] >=_max , calculate(sum(Table[Actual]) - sum(Table[Forecast]), datesytd(Date[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.