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
Lobo1908
Helper I
Helper I

Limit range of measure to a specific year

Hi, 

 

I'm using the following measure to calculate the annual average for a data set. 

 

Average =
CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), ALLEXCEPT('Calendar_lookup','Calendar_lookup'[Year]))
 

My data covers the whole 2022 year and yet to date 2023. 

Could someone please help me adjust this measure to only catch the avarage for 2022. 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

Average =

VAR _t1 = YEAR(TODAY())-1

RETURN


CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), ALLEXCEPT('Calendar_lookup','Calendar_lookup'[Year]),'Calendar_lookup'[Year]=_t1)

View solution in original post

6 REPLIES 6
Ahmedx
Super User
Super User

or

or
Average =
VAR _t1 = YEAR(TODAY())-1
RETURN
CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), ALLEXCEPT('Calendar_lookup','Calendar_lookup'[Year]), CALCULATETABLE('Calendar', 'Calendar_lookup'[Year]=_t1))
Ahmedx
Super User
Super User

Average =

VAR _t1 = YEAR(TODAY())-1

RETURN


CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), ALLEXCEPT('Calendar_lookup','Calendar_lookup'[Year]),'Calendar_lookup'[Year]=_t1)

@Ahmedx This one works perfect, thanks very much 

Ahmedx
Super User
Super User

or

Measure =
VAR _t1 = YEAR(TODAY())-1

RETURN
CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), 'Calendar_lookup'[Year]=_t1)

hi @Ahmedx 

 

The problem with your solution is that it eliminates the ALLEXEPT statement, I need to show the average as a straight line on the Line a clustern column chart. Whitout this statment it calculate trhe avarge for every month 

Ahmedx
Super User
Super User


CALCULATE(AVERAGEX(VALUES('Calendar_lookup'[Date].[Year]),[1.2 % of components]), 'Calendar_lookup'[Year]=2022)

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.