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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
stewbel
New Member

Smartest way to model my data ? Plans vs Actuals

Hi I have a powerquery that merges plans and actuals but need a clever way to deal with overlap.

 

For example in Dec, I want to show Actuals for Jan-Nov and Plans for Dec. I can do this by filtering the source tables for append but this seems kinda painful.  Any suggestions ? (~ are for reading)

 

TblPlan

PersonProjectMonthHrsSrc
Joe~Pixiedust~11/01/2024~20~Plan
Joe~Pixuedust~12/01/2024~40~Plan

 

TblActuals (As of Week 1 in December)

PersonProjectMonthHrsSrc
Joe~Pixiedust~11/01/2024~30~Actuals
Joe~Pixuedust~12/01/2024~5~Actuals

 

1 ACCEPTED SOLUTION
Chewdata
Super User
Super User

Hey!

Create a table that has both the rows for src Plan and Actuals in it.
(created some extra rows for the example).

Chewdata_1-1733651482675.png


With COALESCE() you can switch to a next variable (or measure) if a variable returns a null value. 

The measure will look like this:

Hours = 
var __actuals =
CALCULATE(
    SUM(Hours[Hrs]),
    Hours[Src] = "Actuals"
)

var __plans = 
CALCULATE(
    SUM(Hours[Hrs]),
    Hours[Src] = "Plan"
)

RETURN
// if __actuals returns null then try __plans. If __plans returns null then return 0.
COALESCE(__actuals, __plans, 0)


Outcome:

Chewdata_0-1733651435022.png

 

I hope this is helpfull! If so please accept it as a solution, so other users can benefit from it aswell.

View solution in original post

4 REPLIES 4
Chewdata
Super User
Super User

Hey!

Create a table that has both the rows for src Plan and Actuals in it.
(created some extra rows for the example).

Chewdata_1-1733651482675.png


With COALESCE() you can switch to a next variable (or measure) if a variable returns a null value. 

The measure will look like this:

Hours = 
var __actuals =
CALCULATE(
    SUM(Hours[Hrs]),
    Hours[Src] = "Actuals"
)

var __plans = 
CALCULATE(
    SUM(Hours[Hrs]),
    Hours[Src] = "Plan"
)

RETURN
// if __actuals returns null then try __plans. If __plans returns null then return 0.
COALESCE(__actuals, __plans, 0)


Outcome:

Chewdata_0-1733651435022.png

 

I hope this is helpfull! If so please accept it as a solution, so other users can benefit from it aswell.

Omid_Motamedise
Super User
Super User

Hi @stewbel 

If you want to do it in Power Query, use Date.LocalNow to extract today date, then use  Table.SelectRows twice, one for filtering actual table (previously mounth) and one for plan table, and finally use Table.Group to combine the result of both tables


If my answer helped solve your issue, please consider marking it as the accepted solution.

This is super useful - Thank you

lbendlin
Super User
Super User

No need.  Use COALESCE to try to use the actuals and if they are not present then use the plan.

 

By the way this has nothing to do with modeling yet.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.