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
hoangDAO81
Regular Visitor

Fill down all matched value same year

Hi, i am new to Power Bi, i have some problems when i try to compare value to base year, the table kind of like this 

Total E

IDParaYearDataBaseyearEnergy consumption BY
AEnergy comsumption20182002018 
AEnergy comsumption20193002018 
AEnergy comsumption20204002018 
BEnergy comsumption2019 2019 
BEnergy comsumption2020 2019 
CEnergy comsumption2019 2019 

 

I tried sameperiodlastyear but it not apply to difference base year, also i need a measure to check base year and return value as base year value. 
Energy consumption BY = CALCULATE([Energy comsumption],'Total E'[Baseyear] = 'Total E'[Year])

Then it return only matched value

YearEnergy comsumptionEnrgy consumption BY
2018200200
2019300 
2020400 

Thanks in advance!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @hoangDAO81 ,

Is it necessary to compare [ENERGY CONSUMPTION BY] under the same ID? If so, try this measure:

Energy consumption BY = 
VAR _base_year = SELECTEDVALUE('Total E'[Baseyear])
VAR _result = CALCULATE([Energy comsumption], 'Total E'[Year]=_base_year)
RETURN
_result

vcgaomsft_0-1706493414452.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @hoangDAO81 ,

Is it necessary to compare [ENERGY CONSUMPTION BY] under the same ID? If so, try this measure:

Energy consumption BY = 
VAR _base_year = SELECTEDVALUE('Total E'[Baseyear])
VAR _result = CALCULATE([Energy comsumption], 'Total E'[Year]=_base_year)
RETURN
_result

vcgaomsft_0-1706493414452.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Dear Gao,

This is close with what i need but the values are not show as your table, they only show year 2018, can you refine some of your DAX. Thank you!

Anonymous
Not applicable

Hi @hoangDAO81 ,

Both [ID] and [Year] fields need to be placed in the table visual.

vcgaomsft_0-1706504939182.png

Grouping by year only will result in multiple Base Years corresponding to Years. Or is there some other unspecified calculation logic?

vcgaomsft_1-1706505406901.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

amitchandak
Super User
Super User

@hoangDAO81 , First all all have separate Year/Date table and join back with date or year and then have measures like

 

//Only year vs Year, not a level below

 

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

Fixed Base year

Base  Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=2018 ))

 

or

 

This Year =

Var _min = minx(allselected(Date), Date[Year])

return

CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=_min ))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

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
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