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
hemingt
Helper V
Helper V

How to use VALUES function with filters in DAX

Hello,

Do you know how to use the VALUES function with filter?

I want to get one unique column by VALUES function, and this column also should base on another column condition according to the SELECTEDVALUE?

such as Column A, B

I want to get the VALUES(column A which column B=SELECTEDVALUE)

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @hemingt 

For your case, I think you need to use IN operator in the formula.

for example:

FILTER( TBALE, SELECTEDVALUE( column B) IN VALUES(column B))

Here is a blog for you refer to:

https://www.sqlbi.com/articles/the-in-operator-in-dax/

If you still have problem, please share some sample data and your expected output.

 

Best Regards,

Lin

Community Support Team _ Lin
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

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @hemingt 

For your case, I think you need to use IN operator in the formula.

for example:

FILTER( TBALE, SELECTEDVALUE( column B) IN VALUES(column B))

Here is a blog for you refer to:

https://www.sqlbi.com/articles/the-in-operator-in-dax/

If you still have problem, please share some sample data and your expected output.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

it seems that my solution did not work.

CALCULATETABLE(VALUES(Tasks[Week]), FILTER(Tasks, Tasks[Fix Version] = SELECTEDVALUE(Tasks[Fix Version])))

 

I have a table Tasks, and want to firstly apply the filter "Tasks[Fix Version] = SELECTEDVALUE(Tasks[Fix Version])"

then get the unique value of the column Week by using VALUES.

 

Do you know how to do?

 

 

Thank you @v-lili6-msft 

I use the below to solve my problem

CALCULATETABLE(VALUES(Tasks[Week]), FILTER(Tasks, Tasks[Fix Version] = SELECTEDVALUE(Tasks[Fix Version])))
hemingt
Helper V
Helper V

anyone who can help on this topic? Thank you very much!

if there is anythin unclear, please let me know.

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.