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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
johnathan
Regular Visitor

Use a selected value from a slicer to check valitity of product

i have 2 tables:

table 1 - ProductWeight

CODEOutcomeWeightIncomeWeightpercentage gap
A10.510.3-1.9%
B22.621.5-4.9%
C 33.5 30.5-9%

 

table 2 - TopWeightGap

1%
2%
3%
4%
5%

6%

7%
8%
9%
10%

 

i made a slicer based on table 2 witch i chose the to weight gap percentage/

 

I want it to check which product is valid in terms of the selected percentage gap and i want to display only the valid products

 

 

8 REPLIES 8
johnathan
Regular Visitor

thank you for your help,

i must have missed somthing.

let say the selected Weightpercentage gap is 4% the result table should be -

CODEOutcomeWeightIncomeWeightpercentage gapvalid
A10.510.3-1.9%1
B22.621.5-4.9%0
C 33.5 30.5-9%0

i cant manage to do this with your suggested solution

@johnathan 

if you have created the measure i have sent , 

simply add it to the table instead of adding it in the filter pane . it should return 0 or 1 base on the selection you have from the slicer. 

 

tell me if it works out for you .

 

 

 

 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍

i created the measure as you sent it - 

Measure =
        VAR selected_gap = SELECTEDVALUE(Table2[TopWeightGap])
        var calc = CALCULATE(COUNTROWS(Table1),ABS(table1[weight_percentage_gap]) <= selected_gap)
        RETURN  IF(ISBLANK(calc),1,0)
 
When I add it to the table, All rows in the new column have the value 1
 
johnathan_0-1705929738699.png

 

@johnathan 

did you remove the filter from the filter pane ? 

@johnathan also make sure in the code , 

VAR selected_gap SELECTEDVALUE(Table2[TopWeightGap])
        var calc = CALCULATE(COUNTROWS(Table1),ABS(table1[weight_percentage_gap]) <= selected_gap)
        RETURN  IF(ISBLANK(calc),1,0)
 
that selected_gap  and weight_percentage_gap are rounded to the same decimal number . 
 

 

yes i removed the filter,

and also selected_gap and weight_percentage_gap are rounded to the same decimal number (2)

amitchandak
Super User
Super User

@johnathan , Assuming both are percent column , create measures like

 

Countrows(filter(Table1, round(Table[percentage gap],0) = selectedvalues(Table2[TopWeightGap]) ))

 

 

or

 

Countrows(filter(Table1, round(Table[percentage gap],0) in values(Table2[TopWeightGap]) ))

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
Daniel29195
Super User
Super User

@johnathan 

so when you select let s say 1%, 

you need to show from table 1 all the products with 

Weight

percentage gap <= 1% 

 

if that is the case please refer to the code below : 

 

measure = 

var selected_gap =  selectedvalue('table 2'[TopWeightGap])

 

var calc = 

calculate ( 

countrows(table1), 

table1[weight_percentage_gap] >= selected_gap)
)

 

return

if(isblank(calc),0 , 1 ) 

 

 

now select the visual , go to filter pane, add this measure to the filter pane , under filter on this visual , 

use advanced filtering -->  is --> 1 --> click apply .

 

 

tell me it works out for you . 

 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.