Forum Discussion
SELECTEDVALUE on a slicer returning Blank
Hi,
I am using SELECTEDVALUE to create a Dynamic column, but Selected value is returning blank and because of that Switch function is not giving proper result.
IdenYear =
Based on the selectedvalue from filter I want to retrun below custom column value.
Thanks
- Anonymous2 years ago
HI Ahmedx,
AFAIK, current power bi does not support to create dynamic calculated column/table based on filter effects. They do not work on the same level and you can't use the child to effect its parent level.
For this scenario, I think it should be related selectedvalue function itself. It not suitable to handle multiple values.
When you selected on the slicer, it has match with multiple rows and will return blank if you not enabled the alternateResult option to process. (since calculate column not able to receiver the filter effects from slicer, its row contents show match with whole table records)SELECTEDVALUE function - DAX | Microsoft Learn
Notice: the data level of power bi(from parent to child level)
Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)
Regards,
Xiaoxin Sheng
6 Replies
- Ahmedx
Super User
this is because you have the date as a hierarchy, you need to disable it and create separate columns for the year
- NSC7
Helper I
I am using Year2 column in the slicer and in selectedvalue.
Year2 = 'Calendar'[Date].[Year]VAR SelYear= SELECTEDVALUE('Calendar'[Year2])I have also tried Year2 as Year2 = YEAR('Calendar'[Date]) but it still does not work.- Ahmedx
Super User
see how to disable hierarchies
and create a year column like this
Year = YEAR(Date[Date])