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
nix_ferreira
Regular Visitor

Using data segmentation filter results in DAX calculation

Hello!

 

I have a table that has data and one column (stock) that I use as a filter. This column only has null, 0 and 1 values. The thing is: I want to use this column in a data segmentation filter (like the one below), and reference whichever value the user chooses to filter in DAX defined columns for this same table, to create dynamic calculations. That is: I want to get the output of that filter and use it in DAX calculations.

 

nix_ferreira_0-1718656219415.png

 

The column I want to create would have this syntax:

 

new_column = CALCULATE( column_1 - column_2,  stock = user_defined_stock )

 

where this variable here, `user_defined_stock`, is the output of the filter above (null, 0 or 1, or multiple selection if that's even possible). 

 

How can I achieve this? I tried using SELECTEDVALUE for that, but I can't figure out how.

 

4 REPLIES 4
Anonymous
Not applicable

Hi @nix_ferreira ,

Any update on this? Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Moetazzahran
Resolver II
Resolver II

Hello @nix_ferreira

You can create a variable with the name you specified and enclose the the slicer column you are using with the  Selectedvalue (VAR)
Please try below.

new_column =
VAR user_defined_stock=SELECTEDVALUE(slicercolumn)

Return
CALCULATE( column_1 - column_2,  stock = user_defined_stock )

Please let me know if it solves your requirement. If so, please accept it as a solution, and your kudo is much appreciated.

Hi! That looks like would do the job, but how can I access the output of that data segmentation filter? 

Hello @nix_ferreira,
What do you mean access the output of the data segmentation filter?
When you select the value on the slicer, it will automatically be stored as the variable you declared in the measure then it will calculate the value. 
Can you please clarify?
Thank you

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.