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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.