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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AlessandroBet
Helper V
Helper V

Filter by slider

Hi,

 

i have this formula:

 

#Billing = CALCULATE(
            SUM('Forecast (Billing)'[Billing]),'Forecast (Billing)'[Opportunity Status]="Won")+        
            CALCULATE(
              SUM('Forecast (Billing)'[Billing]),'Forecast (Billing)'[Opportunity Status]="Open",'Forecast (Billing)'[Product]="Product X")
 
and i would like replacing the strings "Won" and "Open" with a slider like this
 
Immagine 2023-08-22 113123.png
  Could you help me?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @AlessandroBet ,

 

Here are the steps you can follow:

1. Enter data – Create a table.

vyangliumsft_0-1693191412081.png

2. Create measure.

Flag =
var _select=SELECTCOLUMNS('Slicer_Table',"Opportunity",'Slicer_Table'[Opportunity Status])
var _count=COUNTX(ALLSELECTED('Slicer_Table'),[Opportunity Status])
return
SWITCH(
    TRUE(),
  "Open" in _select&&NOT("Won") in _select && MAX('Forecast (Billing)'[Opportunity Status]) in _select&& MAX('Forecast (Billing)'[Product])="Product X",1,
  "Won" in _select&&NOT("Open") in _select && MAX('Forecast (Billing)'[Opportunity Status]) in _select ,1,
  _count =2 &&
  OR(
  MAX('Forecast (Billing)'[Opportunity Status]) =MAXX(FILTER(ALL(Slicer_Table),'Slicer_Table'[Index]=MINX(ALL(Slicer_Table),[Index])),[Opportunity Status]) ,
  AND(
      MAX('Forecast (Billing)'[Opportunity Status])= MINX(FILTER(ALL(Slicer_Table),'Slicer_Table'[Index]=MAXX(ALL(Slicer_Table),[Index])),[Opportunity Status]),MAX('Forecast (Billing)'[Product])="Product X")),1,0)
#Billing =
SUMX(
    ALLSELECTED('Forecast (Billing)'),[Billing])

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1693191412082.png

4. Result:

vyangliumsft_2-1693191459886.png

vyangliumsft_3-1693191459888.png

vyangliumsft_5-1693191484449.png

 

Best Regards,

Liu Yang

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

1 REPLY 1
Anonymous
Not applicable

Hi  @AlessandroBet ,

 

Here are the steps you can follow:

1. Enter data – Create a table.

vyangliumsft_0-1693191412081.png

2. Create measure.

Flag =
var _select=SELECTCOLUMNS('Slicer_Table',"Opportunity",'Slicer_Table'[Opportunity Status])
var _count=COUNTX(ALLSELECTED('Slicer_Table'),[Opportunity Status])
return
SWITCH(
    TRUE(),
  "Open" in _select&&NOT("Won") in _select && MAX('Forecast (Billing)'[Opportunity Status]) in _select&& MAX('Forecast (Billing)'[Product])="Product X",1,
  "Won" in _select&&NOT("Open") in _select && MAX('Forecast (Billing)'[Opportunity Status]) in _select ,1,
  _count =2 &&
  OR(
  MAX('Forecast (Billing)'[Opportunity Status]) =MAXX(FILTER(ALL(Slicer_Table),'Slicer_Table'[Index]=MINX(ALL(Slicer_Table),[Index])),[Opportunity Status]) ,
  AND(
      MAX('Forecast (Billing)'[Opportunity Status])= MINX(FILTER(ALL(Slicer_Table),'Slicer_Table'[Index]=MAXX(ALL(Slicer_Table),[Index])),[Opportunity Status]),MAX('Forecast (Billing)'[Product])="Product X")),1,0)
#Billing =
SUMX(
    ALLSELECTED('Forecast (Billing)'),[Billing])

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1693191412082.png

4. Result:

vyangliumsft_2-1693191459886.png

vyangliumsft_3-1693191459888.png

vyangliumsft_5-1693191484449.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.