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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
ValueCreate
Helper I
Helper I

Formula That Only Includes Data Within The Last 5 Years

Hi! I hope I'm able to word this right. I'm essentially asking if theres a way to max out the formula below after 5 years. The formula below is looking back at a historical data. For example, right now its calculating for 6.30.20 by looking back at 6.30.19, 6.30.18, 6.30.17, and all the way until the data begins and taking the average (it is doing the same for the other quarters). But what if I want it to only look back 5 years? (So 6.30.19 until 6.30.15 and then for Q3 it would be 9.30.19 - 9.30.15)

 

Is there a measure I'm able to add so its always taking the average of the last 5 years? And some clients have less than 5 years of data, so I'd think whatever formula is used the clients with less data should be fine.

 

Thanks!

 

 

formulaformulafata formula referencesfata formula references

 

 

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi @ValueCreate 

Just add a conditional in the formula as below:

&&YEAR( 'ValueCreation Ratios' [EffectiveDate])>=YEAR( 'ValueCreation ProjectedQuarters' [ProjectedQuarterEndDate] )-5

 

in the red arrow of this screenshot:

1.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

So adding that conditional formatting did not work. As you can see in the image below all the averages changed (each Q1 should be the same number, and so on for the other quarters) and it removed the last 4 quarters (6.30.25-3.31.26).

 

OG calc1_LI.jpg

Thanks Lin! I will take a look at this next week and let you know if it works.

 

Greg_Deckler
Community Champion
Community Champion

Add an && YEAR([Column]) >= YEAR([Column]) - 5 ?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.