Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Grab multiple values from slicer and put it in a search measure to filter report table
I have Two Tables - No Relationship
'Azure_LastLoginDateReport' - Table, contains Displayname, Email etc of users
'EmailTypeSearch' - Table contains a column [EmailSuffix] which holds search strings such as: @BBC.com, @CNN.com, @Sky.com, @abc.com
I use the slicer 'EmailTypeSearch' [EmailSuffix] to select single values and filter the table report accordingly.
I use a measure "Exists" that looks at the selected Value and then filters the table report based on selected value. - See
Exists = SEARCH(
SELECTEDVALUE('EmailTypeSearch'[EmailSuffix]),
SELECTEDVALUE('Azure_LastLoginDateReport'[Email]),
,-1)
The issue is: When trying to select multiple values in the slicer to filter the table below, it does not work.
I have seen the use of ALLSELECTED and IN and also the use of a variable, similar to the image below, but I do not know how to apply it to a Search function., as detailed above
I will be extremely grateful, if you could assist in getting me pass this stage in my development.
Solved! Go to Solution.
SELECTEDVALUE only works when there is only 1 value. To use multiple strings you could iterate over each one and check for a match. I don't know how well this will do performance-wise but you could try
Exists =
MAXX (
VALUES ( 'EmailTypeSearch'[EmailSuffix] ),
SEARCH (
'EmailTypeSearch'[EmailSuffix],
SELECTEDVALUE ( 'Azure_LastLoginDateReport'[Email] ),
,
-1
)
)
SELECTEDVALUE only works when there is only 1 value. To use multiple strings you could iterate over each one and check for a match. I don't know how well this will do performance-wise but you could try
Exists =
MAXX (
VALUES ( 'EmailTypeSearch'[EmailSuffix] ),
SEARCH (
'EmailTypeSearch'[EmailSuffix],
SELECTEDVALUE ( 'Azure_LastLoginDateReport'[Email] ),
,
-1
)
)
Hi @johnt75 - Thank you so much. That worked as expected. I am only dealing with circa 10k records, therefore it should be fine performance wise. Many thanks.
For ALL - I am also be interetsed how this script can be adapted to use a variable, but only if feasible and possible as I can see cases where this may be needed. for example where a search and sub-search is required
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
112 | |
93 | |
89 | |
35 | |
35 |
User | Count |
---|---|
154 | |
102 | |
82 | |
64 | |
54 |