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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
jts_
Helper I
Helper I

HELP!! Measure show comparison between selected values and other categories

Hi, I have a simple table that contains state, county, and growth rates.
I need to create a measure in Power BI that allows the visualization would change dynamically for comparison.

 

In the project scope, there are 3 states in total. I want each state's average growth rate to stay on the visualization all the time.

In addition, if there is a county is being filtered, this measure would return the average growth rate of each state PLUS the growth rate of the selected county.

 

Below is an example of the data:

StateCounty_NameCountyStateGrowthRate
ArkansasBaxter CountyBaxter County Arkansas2.0%
ArkansasAshley CountyAshley County Arkansas3.0%
ArkansasArkansas CountyArkansas County Arkansas1.5%
KentuckyAdair CountyAdair County Kentucky1.7%
KentuckyAllen CountyAllen County Kentucky3.2%
KentuckyAnderson CountyAnderson County Kentucky6.8%
VirginiaAccomack CountyAccomack County Virginia10.0%
VirginiaAlbemarle CountyAlbemarle County Virginia0.5%
VirginiaAlleghany CountyAlleghany County Virginia6.0%

 

 

If Allen County is filtered, I'd like this measure to show the average rate of each state with Allen County in the comparison.

Arkansas6.5%
Kentucky3.9%
Virginia5.5%
Allen County3.2%


Explainer in photo format:

Screenshot 2023-12-07 164658.png

 

 

 

 

Thank you in advance!! I appreciate all your insights!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jts_ ,

 

Since dynamic tables are not supported in PBI Desktop, your expected result cannot be achieved by presenting the State column and the selected County_Name column on a single column.

(1) My test data is the same as yours.

(2) We create a new table.

Table 2 = 
VALUES('Table'[State])

(3) We can create a measure.

Measure = 
var _rate=CALCULATE(SUM('Table'[GrowthRate]),FILTER(ALL('Table'),'Table'[State]=MAX('Table 2'[State])))
var _rows=COUNTROWS(FILTER(ALL('Table'),'Table'[State]=MAX('Table 2'[State])))
return DIVIDE(_rate,_rows,0)

(4)Then the result is as follows.

vtangjiemsft_0-1702363648727.png

Best Regards,

Neeko Tang

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

Hi @jts_ ,

 

Since dynamic tables are not supported in PBI Desktop, your expected result cannot be achieved by presenting the State column and the selected County_Name column on a single column.

(1) My test data is the same as yours.

(2) We create a new table.

Table 2 = 
VALUES('Table'[State])

(3) We can create a measure.

Measure = 
var _rate=CALCULATE(SUM('Table'[GrowthRate]),FILTER(ALL('Table'),'Table'[State]=MAX('Table 2'[State])))
var _rows=COUNTROWS(FILTER(ALL('Table'),'Table'[State]=MAX('Table 2'[State])))
return DIVIDE(_rate,_rows,0)

(4)Then the result is as follows.

vtangjiemsft_0-1702363648727.png

Best Regards,

Neeko Tang

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

amitchandak
Super User
Super User

@jts_ , You need a disconnected table for that. Assume you have measure m1

 

then have new measure

m2= calculate([m1], filter(Table, Table[State] in values(State[State]) )

 

or

 

m2= calculate([m1], keepvalues( Table[State] in values(State[State]) )


Compare Categorical Data Using Slicers, Compare Two Brands/Categories/Cities: https://youtu.be/exN4nTewgbc

Need of an Independent/disconnected Table in Power BI - Exclude: https://youtu.be/lOEW-YUrAbE

 

 

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