Forum Discussion
Highlighting Selected Column in a Bar Chart Problem
- 2 years ago
I found the solution:
CALCULATE(SUM('Fact'[Val]), ALL('Prod'), 'Prod'[ID] = 1, ALL('DimDates'[Month]), TREATAS(VALUES('UnDimDates'[Month]), 'DimDates'[Month]))
Regarding the issue you raised, my solution is as follows:
1.First, you want to make sure that there is no active relationship between your DimDates and UnDimDates tables. This setting is essential for the TREATAS () function to work as intended, because it actually applies the filter context from one table to another without the need for a physical relationship. TREATAS () is best used when no relationship exists between tables. If there are multiple relationships between tables involved, consider using the USERELATIONSHIP () function instead.
And if the value returned in the table expression does not exist in the column, the value is ignored.
Here is a screenshot of the official document:
Here is the relevant documentation:
TREATAS function - DAX | Microsoft Learn
USERELATIONSHIP function (DAX) - DAX | Microsoft Learn
2.Second, according to the case provided in the official documentation, you can try checking your dax to make sure that the VALUES function is used on slicer connected tables (DimDates) and that the second argument of TREATAS is a column from an unconnected table (UnDimDates).
Thank you again for providing a detailed description of your problem. However, we cannot provide better suggestions and help in the existing information you provide, so we hope you can provide more detailed data information, such as the relationship between tables and data composition, which will be beneficial to our better service for you. And please pay attention to removing sensitive information.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.