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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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