简体   繁体   中英

Check if value is being used as a filter (Power Bi)

I'm using a column as a Power BI binary filter. The data frame is like:

+---------+-------+
| Measure | Value |
+---------+-------+
| Growth  |   $   |
| Profit  |   %   |
| Profit  |   $   |
+---------+-------+

I expect that when I select $ on visual my calculated column bring this:

+---------+-------+----------+
| Measure | Value | Selected |
+---------+-------+----------+
| Growth  |   $   |        1 |
| Profit  |   %   |        0 |
| Profit  |   $   |        1 |
+---------+-------+----------+

Where 1 means that $ was selected by user.

Any ideas on how to generate dax capable of classifying whether the value was selected or not in the visual?

I think you're looking for something along the lines of

Selected = IF ( SELECTEDVALUE ( TableName[Value] ) = "$", 1, 0 )

The DAX functions ISFILTERED and HASONEVALUE may be of interest too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM