Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
tamara_nsb
Helper I
Helper I

Using SelectedValue in SSAS direct query mode fails

Hi,  I need to do a filter on a data column that has combined data in the column using a slicer.   My report is in directQuery mode connected to an SSAS database and I can't get it to work.

 

Table Codes

AA
BB
CC

 

Tasks

AA
AA,BB,CC
AA/CC
AA & BB
BB

 

I created a slicer from Codes[Codes],  which I want to filter the Task table.

I have tried Filter = SEARCH(SELECTEDVALUE('Codes'[Code]), SELECTEDVALUE('Tasks'[Task]), 1, -1)

Filter = CONTAINSSTRING(SELECTEDVALUE('Tasks'[Task]), SELECTEDVALUE('Codes'[Code]))

and tried assigning the slicer value to a measure and displaying it,  displays the value correctly.

I tried replacing the the slicer value with a hard coded value and that works correctly.

 

Does this just not work in Direct Query Mode?   I just wanted to filter on a slicer without splitting the data into multiple rows.    The data is not nicely formatted and trying to split might cause more issues by splitting lines that should not be split,  so I want to do a "contains"  match.   

Any ideas?    I saw a post about a text slicer but my desktop version does not have that,  and I am not allowed to use non-standard visuals.  

 

 

Returns this.   With slicer set to BB

 

Tasks,         Filter Value

AA1
AA,BB,CC1
AA/CC1
AA & BB1
BB1

I expected to get,  which produces something I can use to filter the table.

AA-1
AA,BB,CC4
AA/CC-1
AA & BB6
BB1

 

Any help or other solutions would be great.   

6 REPLIES 6
v-venuppu
Community Support
Community Support

Hi @tamara_nsb ,

Thank you @Shahid12523 for the prompt response.

May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

Thank you.

Shahid12523
Memorable Member
Memorable Member

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.

Shahed Shaikh
v-venuppu
Community Support
Community Support

Hi @tamara_nsb ,

I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.

Thank you.

v-venuppu
Community Support
Community Support

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:

vvenuppu_0-1755851040632.png

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:

vvenuppu_1-1755851278596.png

Please let us know if you need any further assistance.

Thank you.

 

tamara_nsb
Helper I
Helper I

KNP,   thanks for responding.   But the approved version of PowerBi desktop that I am restricted to does not even have "preview features"  in our options.   So a no go.

tamara_nsb_0-1755694056673.png

 

KNP
Super User
Super User

Hi @tamara_nsb,

 

Some more details on your model and the relationships between your tables would be helpful.

 

The easiest solution may be to just turn on the new slicer options in preview features...

 

KNP_0-1755650491677.png

 

This will allow you to do a partial search.

It is a "standard" visual, so should be ok for you to use.

 

If you want the DAX solution, please provide additional model details.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.