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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
00claire
Regular Visitor

How to compare 2022 actuals with 2021 also with 2022 forecast in the same table? Many thanks!

Hi guys,

 

I'm new to PBI and much appreciated if you can help me with the below question (Probably a quite simple one but I have been struggled for some time to be honest)

Many thanks in front!

 

I will simplify my data to below example.

Two data tables: 1) actual by years , 2) forecast

Target: want to show actuals compare with last year, also with forecast in the same table. (I know the Dax to calculate the variances and %, but just cannot bring the correct total here)

 

What I have:

 Actual 
TypesYearAmount
Red20211
Blue20212
Yellow20213
Red20223
Blue20224
Yellow20225

 

 Forecast 
TypesYearAmount
Red20223
Blue20223
Yellow20224

 

What I want to achieve :

 

Types202220212022 Forecast
Red313

Blue

423
Yellow534
Total12610

 

What I have now:

 

Types202220212022 Forecast
Red3110
Blue4210
Yellow5310

 

For 2021, I used DAX sameperiodlastyear, but for 2022 Forecast, when I bring the numbers to table, it shows the sum total of 10 across the 3 colours, instead of by Types.

 

I tried DAX selectedvalue to match Types in 2022 Forecast and the types in 2022. It sort of worked, but wouldn't show total in the

visualisation.

 

Types202220212022 Forecast
Red313
Blud423
Yellow534
Total126Didn't show total

 

 

Thanks heaps for your help!!

 

Claire 

7 REPLIES 7
AilleryO
Memorable Member
Memorable Member

Hi,

The merge can merge queries with multiple columns, so it should not be a problem.

If you want to use more DAX my advice would be to create a date table, linked it to your actual and forecast tables, and then create your visual based on the date table and facts table.

Hope it helps

Hi,

 

Yes I created a date table, and it linked with Forecast table and Actuals.

But both Forecast and actuals have the year 2022. Should I change the 2022 in the Forecast file to something like FC? just to differentiate?

 

Thank you.

The values in Actual and Forecast are different so even in the same year (from date table) they should be in 2 columns ? I think I do not get your exact situation.

Hi,

 

I'll try the merge way and see.

And do you know if there is a way to hide a column or row in PBI but didn't affect the total?

00claire_0-1664205696751.png

Thank you for your help!

Sorry nope. Don't know how to hide, you can try filters (filter panel, filter on this visual) but not sure it will works...

AilleryO
Memorable Member
Memorable Member

Hi,

Maybe you can merge your table using Power Query to make it simpler to display.

Merge Actual to Forecast using your types column (see image below).

MergeQuery.png

Use Left Outer.

Then expand your column with amount from Forecast by clicking on header button (see below) :

ExpandColumns.png

Choose your amount column and then your visual should be easy :

Final_Table.png

Let us know if it works


 

Hi,

Thank you for your prompt help!

Tried the merge way (and I changed to also merge by year), and now looks like below:

00claire_0-1664203211733.png

Is there a way that I can hide this column? Cause there is no forecast for 2021.

 

And this is my simplified example, in my data there are many other columns as well so not sure how Merge works. Is there any DAX similar to sameperiodlastyear, but can help me pick the numbers same year but in a different file (forecast file)? 

 

Thank you!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors