最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powerbi - DAX function VALUES ignores filter - Stack Overflow

programmeradmin3浏览0评论

In Power BI, I am trying to create a table using a DAX expression. In my report, the VALUES function does not behave as I expect it to. Instead of returning filtered values it returns all values.

Microsofts reference information says:

When you use the VALUES function in a context that has been filtered, the unique values returned by VALUES are affected by the filter.

Am I misunderstanding the above information or could something in my report cause a different behavior?

Example: Table "Users" has two columns, "Name" and "Car". Table "Brands" has one column, "Brand". There is a one to many relationship from Brands to Users. I use this formula to create a new table:

SelectedNames = VALUES(Users)

I then make three visuals:

  1. A Table showing Users.
  2. A Slicer showing Brand[Brand].
  3. A Table showing SelectedNames.

I expect the third visual to show the same (distinct) names displayed in the first visual. It does not. Instead it always shows the full list of names regardless of what is selected in the slicer.

A screenshot of my report:

In Power BI, I am trying to create a table using a DAX expression. In my report, the VALUES function does not behave as I expect it to. Instead of returning filtered values it returns all values.

Microsofts reference information says:

When you use the VALUES function in a context that has been filtered, the unique values returned by VALUES are affected by the filter.

Am I misunderstanding the above information or could something in my report cause a different behavior?

Example: Table "Users" has two columns, "Name" and "Car". Table "Brands" has one column, "Brand". There is a one to many relationship from Brands to Users. I use this formula to create a new table:

SelectedNames = VALUES(Users)

I then make three visuals:

  1. A Table showing Users.
  2. A Slicer showing Brand[Brand].
  3. A Table showing SelectedNames.

I expect the third visual to show the same (distinct) names displayed in the first visual. It does not. Instead it always shows the full list of names regardless of what is selected in the slicer.

A screenshot of my report:

Share Improve this question asked Mar 19 at 12:45 FredrikFredrik 6701 gold badge7 silver badges22 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

When creating a table object in DAX, the code is evaluated and run each time there is a change to the data model. Filters interactions do not impact the table, and therefore you should use a measure instead of a table.

From your example, you should activate the one to many relationship between users and brands, and that should filter the list of users you are looking for.

发布评论

评论列表(0)

  1. 暂无评论