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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
limarchi7
Frequent Visitor

filter in DAX based on choice from other filter/param

Hello,

 

I would like a dataset to be filterable in the following way:

 

Change = var filtered =
FILTER(dataset, dataset[column] = SELECTEDVALUE(other_dataset[column2]))
RETURN
CALCULATE ( sum(dataset[units]), filtered )
 
The key being "SELECTEDVALUE(other_dataset[column2])", so in other words the calculation changes based on the value the user chooses in the other filter/slicer. Is this not possible in PowerBI? I have tried it many ways, for example, selectedvalue not being embedded in the calculation itself, but pointing to a selectedvalue column. When I try it, other_dataset[column2]) seems to come up blank, instead of having the value selected from the filter.
2 REPLIES 2
amitchandak
Super User
Super User

@limarchi7 , Hope the two are not connected

 

Change = var filtered =
FILTER(dataset, dataset[column] in values(other_dataset[column2]))
RETURN
CALCULATE ( sum(dataset[units]), filtered )

 

 

Also, consider treatas

https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/

hi @amitchandak ,

 

Thanks for the reply. If I try doing this, it returns the entire list, instead of only the value currently selected (in the slicer).

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.