Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

SELECTEDVALUE not working in DAX filter

Hi Team,

I have a slicer where i am selecting a Hotel ID from a list of hotel ids.I have created a measure also for the selected value as

selectedHotel = SELECTEDVALUE(Hotels[HOTEL_ID]). I am able to see the value for this measure in the Card Visual also. The card visual is displaying the correct value based on my selection.
I want to created a filtered table based on the selection. I am using the direct query mode due to my security constraints and data volume.
 Ways i tried are given below :-
1. Using the measure
Table tempHotel= var sel =[selectedHotel]
var electedHotel =IF(NOT ISBLANK(sel);sel;1713)
RETURN FILTER(Hotels;Hotels[HOTEL_ID] = electedHotel)
2. Using the selected value
Table tempHotel= var sel = SELECTEDVALUE(Hotels[HOTEL_ID])
var electedHotel =IF(NOT ISBLANK(sel);sel;1713)
RETURN FILTER(Hotels;Hotels[HOTEL_ID] = electedHotel).
In both the scenarios its filtering with the alternate value of 1713 and is not using the actual selected value. Am I doing something wrong. Please help

1 Reply

  • sturlaws's avatar
    sturlaws
    Icon for Resident Rockstar rankResident Rockstar

    Hi Anonymous,

    you use the term 'filtered table', are you trying to create a new table in your model? It is not possible to update or create a table in a model based on a slicer selection.

     

    Or are you trying to create a temporary table in a measure so you can do something like COUNTROWS('filtered table')? Then perhaps upload a sample report, to make it easier to help you.

    how to upload pbix-files

    cheers,
    S