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

Compare a column with itself in a context modified by filters

Hello,

 

I have a table visual showing hours spent on some projects, the first column is the year of the date field of my table.

And the last column is a measure that must return the historical average of time spent yearly from the beginning to the previous year.

Cado_0-1623912258751.png

I managed to calculate it for 2021 using 'Table'[date].[Year]<YEAR(TODAY()) in the filter section of the calculate function but if I scroll down the table visual to 2020 it's not working anymore because it takes 2020 into account instead of stopping at 2019.

So I wish to change the filter to something like 'Table'[date].[Year]<FILTERED('Table'[date].[Year]) but I don't find the good formula.

 

How would you proceed to compare the unfiltered date value and the filtered one ? whithout using a calendar table 

 

Thanks in advance.

Regards,

Cado

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
CALCULATE(
    AVERAGE('Table'[Value]),
    FILTER(
        ALL('Table'[Year]),
        'Table'[Year] < MAX('Table'[Year])
    )
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
CALCULATE(
    AVERAGE('Table'[Value]),
    FILTER(
        ALL('Table'[Year]),
        'Table'[Year] < MAX('Table'[Year])
    )
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

Hi @v-kkf-msft 

 

Thank you for your help, the filter with the MAX function works perfectly !

 

Have a nice day.

Cado

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