I have used DAX to create a combined Plan / Actual forecast for the rest of the year. Same methodology also working for Forecast / Actual row in the attached table.
e.g. Plan/Actual (GSV) = IF([Ex Factory (GSV)]=0,[Plan (GSV)],[Ex Factory (GSV)])
However, the Total for the year is incorrect as the formula seems to consider that Ex Factory has a value for the year, and so takes that value rather than calculate each month individually and then summing all the Monthly results. How can I fix the Annual Total?
Hi I’ve dummied up how I would do it in Excel in the attached Screenshot.
Essentially I want to test whether TOTALCustomerMonth has sales (and assign this result to the SKUMonth Row)
Then use that result to choose whether ACTUALSALES or FORECAST is populated into the Result Cell). Note: A standard ‘If Cell = 0, then take the Forecast’ will be incorrect if the cell just happens to have zero sales for the month.
I’m quite confident that this just requires an iterating function like SUMX instead of the IF statement, as you need to be iterating through every row here.
Totals usually don’t add up correctly when using IF statements, that’s why I believe this is where is not working.
Here’s a good tutorial to review around iterating functions
Don’t use Calculated Columns. They are unnecessary. You want to be using measures wherever possible.
This is where this has come unstuck straight away and why I was really unable to give a solid answer straight away, because I wasn’t aware that these calcs where from columns instead of measures.
One thing I always mention around DAX is always just start with the simplest measures. Like I have done here.