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! Request now

Reply
Anonymous
Not applicable

Get segment value when segment is used for calculations and not filtering

Hi,
I just begin with PowerBI and I would like to create a report where the user can select somes values from segments in order to sort the table, not filtering.
For example :

 

nochoice.PNG

and when the user chooses :

 

choice.PNG

So I have disabled the automatic filtering with the "Edit interactions" options in order to keep all the lines in my table but now, I am not able to calculate the segment value in my table. So I can't compare the segment value with the table value to calculate the score.


I get the segment value through this solution :
https://community.powerbi.com/t5/Desktop/How-to-get-filter-values-applied-to-a-label-displayed-in-Re...
but it doesn't work in my case.


How i can obtain the segment value in my table when i have disabled the filter ?


Thank you ?

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

To achieve this you will need to create two dimensions, one for weapons and second for protection and a measure like below.

Score = 
VAR _weapon = CALCULATE( COUNTROWS( 'Table' ), ALL( 'Protection'[Protection] ) ) 
VAR _protection = CALCULATE( COUNTROWS( 'Table' ), ALL( Weapon[Weapon] ) ) 
RETURN _weapon  + _protection + 0
I have attached a file with a model for reference
 
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

 

View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

To achieve this you will need to create two dimensions, one for weapons and second for protection and a measure like below.

Score = 
VAR _weapon = CALCULATE( COUNTROWS( 'Table' ), ALL( 'Protection'[Protection] ) ) 
VAR _protection = CALCULATE( COUNTROWS( 'Table' ), ALL( Weapon[Weapon] ) ) 
RETURN _weapon  + _protection + 0
I have attached a file with a model for reference
 
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

 

Anonymous
Not applicable

OK, if i calculate the selectedvalue with this formula, I can do the comparaison :

SelectedValueProtection = CALCULATE(SELECTEDVALUE(data[Protection]);ALL( Weapon[Weapon] ))solution.PNG

 

Thank you for your help

Hi @Anonymous 

Sorry, for the late reply, please see the attached solution.

I've split the original score measure into two to achieve this.

Score Protection = CALCULATE( COUNTROWS( 'Table' ), ALL( Weapon[Weapon] ) ) 
Score Weapon = CALCULATE( COUNTROWS( 'Table' ), ALL( 'Protection'[Protection] ) ) 
Score = [Score Weapon]  + [Score Protection] + 0

Please see the attached file for reference.

 

Your solution is equally as good, so you might stick to it! 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

Anonymous
Not applicable

Thank you for the tip, it works perfectly !!!


But now, i have another problem.
I would like to change the font color if the table value matches with the segment value.

So, i would like to compare these 2 values.

But the SelectedValue(table[Weapon]) or the SelectedValue(table[Protection]) is not empty only for the line matches with 2 choices, so the comparaison fails :

ColorPb.PNG

 

How can I do ?

 

Best Regards,

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
Top Kudoed Authors