Forum Discussion
Using SelectedValue in SSAS direct query mode fails
- 1 year ago
Hi tamara_nsb ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you KNP for the prompt response.
Even I was able to see the Preview Features in my system.You can find the below screenshot:
Check with the Admin Team or else if possible try to upgrade to latest version by downloading from Microsoft store.
You can find the below screenshot for the version that I have in my system for your reference:Please let us know if you need any further assistance.
Thank you.
- 1 year ago
In DirectQuery mode, SELECTEDVALUE with SEARCH or CONTAINSSTRING often fails because it can’t translate to SQL.
Workarounds:
Disconnected slicer + measure:
TaskFilter = IF(CONTAINSSTRING(MAX(Tasks[Task]), SELECTEDVALUE(Codes[Code])), 1, 0)
Then filter the table where TaskFilter = 1.Preprocess Tasks: Split combined values into separate rows before loading.
Server-side view/query: Filter via SSAS view or function.
Measure-based filtering is usually the easiest in DirectQuery.
- 11 months ago
This was the solution that worked for me. But for some reason I can't accept as solution. I am unable to upgrade or change my powerBi desktop version so that was not an option for me. I got this working but only when I put the measure in the SSAS model and not in power bi.
containsSelectedValue:=
VAR SearchTask = SELECTEDVALUE( MastList[Value])
RETURN
CALCULATE(
COUNTROWS('Table2'),
FILTER(
'Table2',
CONTAINSSTRING('Table2'[Value], SearchTask)
)
)Then add a filter to the table that containsSelectedValue = 1
In DirectQuery mode, SELECTEDVALUE with SEARCH or CONTAINSSTRING often fails because it can’t translate to SQL.
Workarounds:
Disconnected slicer + measure:
TaskFilter = IF(CONTAINSSTRING(MAX(Tasks[Task]), SELECTEDVALUE(Codes[Code])), 1, 0)
Then filter the table where TaskFilter = 1.
Preprocess Tasks: Split combined values into separate rows before loading.
Server-side view/query: Filter via SSAS view or function.
Measure-based filtering is usually the easiest in DirectQuery.
This was the solution that worked for me. But for some reason I can't accept as solution. I am unable to upgrade or change my powerBi desktop version so that was not an option for me. I got this working but only when I put the measure in the SSAS model and not in power bi.
containsSelectedValue:=
VAR SearchTask = SELECTEDVALUE( MastList[Value])
RETURN
CALCULATE(
COUNTROWS('Table2'),
FILTER(
'Table2',
CONTAINSSTRING('Table2'[Value], SearchTask)
)
)
Then add a filter to the table that containsSelectedValue = 1