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
Anonymous
Not applicable

Use yearaverage as target line

Hi all,

 

i'm facing a new issue. The customer would like to see the average of 2 years ago as a constant targetline in the chart. 

So i created the average of 2 years ago:

 

Norm eigenvertraging = 
    CALCULATE(AVERAGE('Vertraging'[eigenvertraging])
    ,DATEADD('Date'[Date], -2, YEAR)
    )

But when i use this, it obviously shows the average per week in the chart. I tried using ALL, ALLSELECTED but no luck unfortunately

So my question is: How can i turn this into the average over the whole year so i can use it as a targetline?

 

Tnx!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try like

 

Norm eigenvertraging =
var _1 = maxx(allselected('Date'), 'Date'[Date])
var _2= year(_1) -2
return
CALCULATE(AVERAGE('Vertraging'[eigenvertraging])
,filter(all('Date') year('Date'[Date]) = _2
))

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

View solution in original post

v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

You could try the following measure:

TEST1 = 
VAR LASTTWOYEARDAY =
    DATE ( YEAR ( TODAY () ) - 2, MONTH ( TODAY () ), DAY ( TODAY () ) )
VAR TEST1 =
    CALCULATE (
        AVERAGE ( Vertraging[eigenvertraging] ),
        FILTER (ALL('Date'),'Date'[Date]<=LASTTWOYEARDAY)
    )
RETURN
    TEST1

vluwangmsft_0-1629269522606.png

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

 

Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

You could try the following measure:

TEST1 = 
VAR LASTTWOYEARDAY =
    DATE ( YEAR ( TODAY () ) - 2, MONTH ( TODAY () ), DAY ( TODAY () ) )
VAR TEST1 =
    CALCULATE (
        AVERAGE ( Vertraging[eigenvertraging] ),
        FILTER (ALL('Date'),'Date'[Date]<=LASTTWOYEARDAY)
    )
RETURN
    TEST1

vluwangmsft_0-1629269522606.png

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

 

Best Regards

Lucien

amitchandak
Super User
Super User

@Anonymous , Try like

 

Norm eigenvertraging =
var _1 = maxx(allselected('Date'), 'Date'[Date])
var _2= year(_1) -2
return
CALCULATE(AVERAGE('Vertraging'[eigenvertraging])
,filter(all('Date') year('Date'[Date]) = _2
))

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