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
augustindelaf
Impactful Individual
Impactful Individual

display multiple elements with SELECTEDVALUE

Hello,

 

I am using the DAX measure SELECTEDVALUE to display the value of a column that is filtered in a table visual.

But I can't find a way to display multiple elements.

 

For instance, if "France" is selected in the field 'Data'[Nationality], the DAXmeasure SELECTEDVALUE will display "France", and that is good. (SelectedNationality = SELECTEDVALUE(data[Nationality])

But if I select "France" and "Italy" in this filed, I would like that my measure displays both "France" and "Italy".

 

Any idea HOW ?

Best regards

Augustin

2 ACCEPTED SOLUTIONS

hi, @augustindelaf 

Try this formula: 

Selected PDLs=
CONCATENATEX ( VALUES ( Data[Nationality] ) , [Nationality] , ",")

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@augustindelaf  Please try this in your measure..

 

MonthSelection = 
VAR _Count = COUNTROWS(VALUES(_Date[Month]))
VAR _Concat = CONCATENATEX(VALUES(_Date[Month]),[Month],",")
RETURN IF(_Count>2,"Multiple Selection",_Concat)

image.pngimage.pngimage.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

16 REPLIES 16
OwenAuger
Super User
Super User

Hello Augustin,

 

I think CONCATENATEX is going to do what you want. CONCATENATEX iterates over a table and concatenates a text expression evaluated for each row of the table. In particular, you can use CONCATENATEX with VALUES to concatenate distinct values from a column.

 

You could write a measure like this to create a comma-separated string of Nationality values.

 

SelectedNationalities =
CONCATENATEX (
    VALUES ( data[Nationality] ),
    ", "
)

Is that what you were looking for?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

hi 

 

@OwenAuger 

 

It would be perfect but it doesn't work.

My measure (exactly the one you wrote) is not in error, and it finds the field nationality but the only value that is displayed is the Comma.

 

Capture.PNG

 

2 values selected

 

hi, @augustindelaf 

Try this formula: 

Selected PDLs=
CONCATENATEX ( VALUES ( Data[Nationality] ) , [Nationality] , ",")

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is what I needed...thank you so much!!

@v-lili6-msft  I also need to display "Multiple Selection" IF the Concatenex values are more than 2.

 

Than means :

1 selection = [Selection1]

2 selections =[Selection1] ", " [Selection2] 

3 sleections and more = "Multiple Selection"

 

how can I do that, please ?

What I did :
 
Selected Nationality =
IF(COUNTA( VALUES < 2;
CONCATENATEX ( VALUES ( Data[Nationality] ) ; Data[Nationality] ; ", ")
;"Multiple Selection"
))
 
But it does not work

@augustindelaf  Please try this in your measure..

 

MonthSelection = 
VAR _Count = COUNTROWS(VALUES(_Date[Month]))
VAR _Concat = CONCATENATEX(VALUES(_Date[Month]),[Month],",")
RETURN IF(_Count>2,"Multiple Selection",_Concat)

image.pngimage.pngimage.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Not working when selectint single value for me 

How do I display "All Months" when all or none of the months are selected?

Anonymous
Not applicable

it works fine, thank you!

Anonymous
Not applicable

Make Variable in DAX , Give any name like "My Selection" then 

Make small dimension table (Measure Selection) with your selected Measure name and use it in DAX.

Here is Formula : I have three measure and I made a table with three name and used in DAX

 

DAX :


Selected Measure:= Var MySelection = CALCULATE(ALLSELECTED('Measure Selection'[Measure Name ]))
RETURN SWITCH( TRUE(),MySelection = "Discharge",[Discharge Count],MySelection="Admission",
[Admission Count],MySelection="Patient Days",[Patient Days],[Discharge Count])

Hi @Anonymous 

 

it is an old request that I made,

i don't remember the use case it was necessary for.

 

Anyways, thank you.

@PattemManohar thanks for the reply !

i think it works but I used another formula :

 

Many thanks anyway
Label - Selected Nationality = 
IF(
     COUNTROWS( VALUES( Data[Nationality] ) ) ❤️ 
    ; CONCATENATEX(VALUES( Data[Nationality] ); Data[Nationality]; ", " )
    ; "Multiple Selection"
)

many thanks @v-lili6-msft !

it works now 🙂

very nice from you

v-lili6-msft
Community Support
Community Support

hi, @augustindelaf 

SELECTEDVALUE returns the value when the context for columnName has been filtered down to one distinct value only. Otherwise returns alternateResult.

So you could just need to use IN and VALUES instead of SELECTEDVALUE

For example:

(SelectedNationality IN VALUES(data[Nationality])

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft could you please write the exact measure ?

I wrote the one you gave me but it didn't work.

 

Many thanks in advance.

Best regards,

Augustin

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.