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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Cbutler
Helper III
Helper III

How to filter a page by the same column as min and max?

I am building a report based on the change in Welsh language speakers (by local authority(LA)) from the Census, inc years 1991, 2001, 2011 and 2012. 

I have this variable to calc the % diff, as you can see the Min and Max of the year is working off the same column. I want the end user to be able to determine what the min and max years are - eg, be able to dynamically compare 1991 with 2001, or 2011 with 2021, or 2001 and 2021 etc..... but I can't work out how to do this with the slicers on the page as the values are off the same column. 

I have tried a between slicer - but the issue is that this runs all the values between 1991 and 2021, and I don't want people to be able to pick 1997 for example as it will not be clear that this is the figure from 1991.

% of Welsh speakers = sum('LA, age and year'[Welsh Speakers])/sum('LA, age and year'[Persons])

 

Variable % change welsh speakers =
VAR Min_Year =
    CALCULATE (
        [% of Welsh speakers],
        'LA, age and year'[Year] IN { MIN ( 'LA, age and year'[Year]) }
    )
VAR Max_Year =
    CALCULATE (
        [% of Welsh speakers],
        'LA, age and year'[Year] IN { MAX ( 'LA, age and year'[Year] ) }
    )
RETURN
    Max_Year - Min_Year


Any advice how to allow the Min and Max year to be filtered on the page so that the variable dynamically changes? 

Dataset layout 

YearLAAgePersonsWelsh Speakers
2021Blaenau Gwent16-39191851614
2011Blaenau Gwent16-39208891578
2001Blaenau Gwent16-39215151256
1991Blaenau Gwent16-3923778425
2001Bridgend16-39398393729
2011Bridgend16-39409254380
2021Bridgend16-39410114684
1991Bridgend16-39430342537
2021Caerphilly16-39501296690
2011Caerphilly16-39535106616
2001Caerphilly16-39539935354
1991Caerphilly16-39578622919
1991Cardiff16-391026716712
2001Cardiff16-3911469112073
2011Cardiff16-3913862615086
2021Cardiff16-3914161817118
2021Carmarthenshire16-394774619067
2001Carmarthenshire16-394821321264
2011Carmarthenshire16-394867319847
1991Carmarthenshire16-395043823974
1991Ceredigion16-391898910737
2021Ceredigion16-39208739085
2001Ceredigion16-392401810796
2011Ceredigion16-392462510057
2021Conwy16-39269018229
2011Conwy16-39278278564
2001Conwy16-39289858734
1991Conwy16-39303078605



@Greg_Deckler any ideas? 

2 REPLIES 2
amitchandak
Super User
Super User

@Cbutler , Based on what I got, Create a table with the distinct year , join with year of your table

 

new measure =
var _max = maxx(allselected(Year),Year[Year])
var _min = minx(allselected(Year),Year[Year])
return
calculate( sum(Table[Value]), filter('Year', 'Year'[Year] =_max)) - calculate( sum(Table[Value]), filter('Year', 'Year'[Year] =_min))

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

Thansk @amitchandak , Could you give me a link to your pbix. file? I tried something similar and it didn't work. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.