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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dkernen
Resolver II
Resolver II

Report Builder | Converting DAX Query to Multi-Select Parameter

I am having trouble converting my multi-select DAX into Report Builder:

// DAX Query
DEFINE
VAR __DS0FilterTable =
TREATAS({"07072021-047", "07132021-013"}, 'IPAR'[Referral_ID])

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('factCase'[OStatus_DT])),
AND(
'factCase'[OStatus_DT] >= @p_sDate,
'factCase'[OStatus_DT] < @p_eDate
)
)

I am very comfortable in Visual Studio 2019.  But the examples I have seen for multi-select are for SQL.  My multi-select, in this case, has available values sourced from a query.   

https://mwtn-my.sharepoint.com/:u:/g/personal/dkernen_mwtn_org/EU7Oryj-XgtDm_KHFNCWZm0B7DXNeH9uOI8qt...

Thank you so much for any help you can provide!
@ReportServer @Parameters

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

FYI, The post is for "Report Server" group. 

 

Based on your file, you configured the "p_Referral" as multiple values. 

 

1) you need to add the parameter to the dataset as below. 

    <QueryParameter Name="Referral">
     <Value>=Join(Parameters!p_Referral.Value, "|")</Value>
     </QueryParameter>

 

2) Change your DAX as below, in the dataset

VAR __DS0FilterTable =
TREATAS({"07072021-047", "07132021-013"}, 'IPAR'[Referral_ID])

 

as

 

VAR __DS0FilterTable =
// TREATAS({"07072021-047", "07132021-013"}, 'IPAR'[Referral_ID])

FILTER( VALUES('IPAR'[Referral_ID]), PATHCONTAINS (@Referral, 'IPAR'[Referral_ID]))

 

3) Optional: DAX generated by Power BI is typically huge. you can tweak it (or reduce it) to your needs.

 

Hope this helps!

View solution in original post

2 REPLIES 2
dkernen
Resolver II
Resolver II

@sevenhills Thank you so, so much!  I struggled with this for so long before receiving your solution.  I apologize for using the wong forum and I will work to tighten-up the DAX.

sevenhills
Super User
Super User

FYI, The post is for "Report Server" group. 

 

Based on your file, you configured the "p_Referral" as multiple values. 

 

1) you need to add the parameter to the dataset as below. 

    <QueryParameter Name="Referral">
     <Value>=Join(Parameters!p_Referral.Value, "|")</Value>
     </QueryParameter>

 

2) Change your DAX as below, in the dataset

VAR __DS0FilterTable =
TREATAS({"07072021-047", "07132021-013"}, 'IPAR'[Referral_ID])

 

as

 

VAR __DS0FilterTable =
// TREATAS({"07072021-047", "07132021-013"}, 'IPAR'[Referral_ID])

FILTER( VALUES('IPAR'[Referral_ID]), PATHCONTAINS (@Referral, 'IPAR'[Referral_ID]))

 

3) Optional: DAX generated by Power BI is typically huge. you can tweak it (or reduce it) to your needs.

 

Hope this helps!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.