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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ChrisFloko
Frequent Visitor

How to make dropdown slicer present "multiple selections" if more than one value has been selected?

Hello everyone, 

 

In order to solve the problem I had in the 1st screenshot I applied the dax code  shown in the 2nd screenshot. The code seems to be working perfectly fine as long as the user has chosen one specific deparment (single selection), the output is shown in screenshot 3.  However in the case where a user picks a second deparment (screenshot 4), the measure will continue to show only one of the two or multiple selections. Is there a way to tweak the code  (or a completely different code), that could instead show "Multiple selections" (Screenshot 5) when the user has chosen more than one departments? 

1st

ChrisFloko_0-1698220255864.png

2nd 

ChrisFloko_1-1698220350188.png

3rd 

ChrisFloko_2-1698220487326.png

4th 

ChrisFloko_3-1698220886258.png

5th 

ChrisFloko_4-1698221100886.png

 

Thank you in advance!

 

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

It seems you want to modify your DAX code to handle multiple selections in a dropdown slicer and display "Multiple selections" when more than one department is selected. To achieve this, you can use the following DAX code:

 

SelectedDepartments = CONCATENATEX(ALLSELECTED('YourTable'[Department]), 'YourTable'[Department], ", ")

 

Replace 'YourTable' with the actual name of your table and 'Department' with the name of the column you are filtering.

This code uses the CONCATENATEX function to concatenate the selected department values into a single string separated by commas. If multiple departments are selected, it will display all the selected departments separated by commas. If only one department is selected, it will display that department's name. You can then use the "SelectedDepartments" measure in your report to display the result.

Here's how you can use this measure:

  1. Create a measure in Power BI using the above DAX code.
  2. Insert a text box or card visual in your report.
  3. Set the visual to display the "SelectedDepartments" measure.

Now, when you select multiple departments in your dropdown slicer, the visual will display "Multiple selections," and when you select a single department, it will display the department's name.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

2 REPLIES 2
ChrisFloko
Frequent Visitor

@123abc Thank you so much for your reply. Truly appreciated!
I had to implement your solution within the code that I aleready had (to cater for the hierarchy) and it worked perfectly. Here is the full solution if anyone has the same challenge. 

ChrisFloko_0-1698315456781.png

 


Additional note: The output with the departments being separated by comma works perfectly fine, but when I said "Multiple selections" I literally meant if there is a way to present that exact text string if more than one departments is selected? (as shown in screenshot 5) . Basically if there is a way to modify the dax code to understand if multi-selection is present and then output a cerartin "text"  when there is. 

123abc
Community Champion
Community Champion

It seems you want to modify your DAX code to handle multiple selections in a dropdown slicer and display "Multiple selections" when more than one department is selected. To achieve this, you can use the following DAX code:

 

SelectedDepartments = CONCATENATEX(ALLSELECTED('YourTable'[Department]), 'YourTable'[Department], ", ")

 

Replace 'YourTable' with the actual name of your table and 'Department' with the name of the column you are filtering.

This code uses the CONCATENATEX function to concatenate the selected department values into a single string separated by commas. If multiple departments are selected, it will display all the selected departments separated by commas. If only one department is selected, it will display that department's name. You can then use the "SelectedDepartments" measure in your report to display the result.

Here's how you can use this measure:

  1. Create a measure in Power BI using the above DAX code.
  2. Insert a text box or card visual in your report.
  3. Set the visual to display the "SelectedDepartments" measure.

Now, when you select multiple departments in your dropdown slicer, the visual will display "Multiple selections," and when you select a single department, it will display the department's name.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.