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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

MEASURE : tricky condition to concatenate multiple columns based on slicer value(s)

Hi,
Here's a tricky measure to do, on my client demand.

I have 2 sheets. On each, I have a bar chart with years on absissa.
 
By default, a text has to appear somewhere saying that years selected are ">= 2020"
If users select one or several years on the bar chart, it has to concatenate the years separated by a comma ("in 2021, 2022" for example)

When do I know that nothing is selected on the bar chart ?

When I use SELECTEDVALUE, it is BLANK() when nothing is selected AND when two or more years are selected.

any others options to detect it ?

Here's my attempt which returns ">=2020" when 2 or more years are selected

Sélection Année = 
var concatYEARS = CONCATENATEX ( VALUES ( '#PERIODE_DBT_TVX'[Valeur_lib]), [Valeur_lib],  ",")
var selection = SELECTEDVALUE('#PERIODE_DBT_TVX'[Valeur_lib])
return


--attempt 1
SWITCH(TRUE(),
            selection = blank(),">= 2020", 
            "in " & concatYEARS)



Thanks a lot !

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

Use ISFILTERED( ) on the column in the slicer. It will only be false when nothing is selected

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @AlB you rock !

 

For those who might be interested in, here's how I finished my measure.

 

Sélection Année = 
var concatYEARS = CONCATENATEX ( VALUES ( '#PERIODE_DBT_TVX'[Valeur_lib]), [Valeur_lib],  ",")
return

SWITCH(TRUE(),
            ISFILTERED('#PERIODE_DBT_TVX'[Valeur_lib]) = FALSE(),">= 2020",
            ISFILTERED('#PERIODE_DBT_TVX'[Valeur_lib]),  "en " & concatYEARS)

 

AlB
Community Champion
Community Champion

Hi @Anonymous 

Use ISFILTERED( ) on the column in the slicer. It will only be false when nothing is selected

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.