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

Dynamically selecting the most recent value for each category

I'm trying to create a filled map that shows the current Governor's party affiliation for each state at any given time (controlled using a slicer). The map shown below uses 'State' for Location and 'Party' for the Legend.

 

Solutions I have tried:

 

1) Simply applying a slicer

 

I think this could work, however, the legend works alphabetically and can't be changed to date (that I'm aware of). Thus, if in the given range for a state, there were democratic and republican governors, then the map will show blue for the democratic one as it comes first alphabetically regardless of which came first/last.

 

2) Creating calculated tables:

     

Table 1: Latest = summarize(all_states, all_states[State], "Took office", MAX(all_states[Took office]))
Table 2: Most Recent Values = SUMMARIZE( FILTER(CROSSJOIN(all_states, Latest), all_states[State] = Latest[State] && all_states[Took office] = Latest[Took office]), all_states[State], all_states[Governor], all_states[Party], all_states[Took office], all_states[Left Office])
 
This will give me the current (latest date for each state regardless of slicers) information for each state, but it isn't date sliceable as the slicer is applied to the "Most Recent Values" table instead of its source table.

 

3) You can't create a measure for each state individually as the map only accepts a single column for the legend.

 

 

Mini subset of data (Alabama, Alaska, and Arizona from 1/1/2000 - 1/14/2020 [Took office dates]):

StateGovernorPartyTook officeLeft Office
AlaskaMike DunleavyRepublican12/3/201811/5/2020
AlabamaKay IveyRepublican4/10/201711/5/2020
ArizonaDoug DuceyRepublican1/5/201511/5/2020
AlaskaBill WalkerIndependent12/1/201412/3/2018
AlabamaRobert J. BentleyRepublican1/18/20114/10/2017
AlaskaSean ParnellRepublican7/26/200912/1/2014
ArizonaJan BrewerRepublican1/21/20091/5/2015
AlaskaSarah PalinRepublican12/4/20067/26/2009
AlabamaBob RileyRepublican1/21/20031/17/2011
ArizonaJanet NapolitanoDemocratic1/6/20031/21/2009
AlaskaFrank MurkowskiRepublican12/2/200212/4/2006

 

 

Matthew-15243_0-1604608737276.png

 

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Not very clear. But if you are looking for Winner Map, refer to my blog

https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814

 

In case you need current active then refer to HR Blog, Hope you are using a filter on some time element

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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