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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Conditional Title using Quick measure calculation 'Concatenated list of values'

Hello all,

 

My goal is to use a Card-Visualization to list all selected filters from a slicer. For this I used a quick measure and selected 'Concatenated list of values'. While this gets me the result I want, I would prefer it, if each filter in the card would start on a new line. Additionally, I would like the card to just say 'All fields' when more than 5 filters are active.

 

I tried to apply these changes using DAX, but having no experience using it, I could not make it work only by looking it up on the internet.

 

 

List of Field values =
VAR __DISTINCT_VALUES_COUNT = DISTINCTCOUNT('Planning'[Field])
VAR __MAX_VALUES_TO_SHOW = 5
RETURN
    IF(
        __DISTINCT_VALUES_COUNT > __MAX_VALUES_TO_SHOW;
        CONCATENATE(
            CONCATENATEX(
                TOPN(
                    __MAX_VALUES_TO_SHOW;
                    VALUES('Planning'[Field]);
                    'Planning'[Field];
                    ASC
                );
                'Planning'[Field];
                ", ";
                'Planning'[Field];
                ASC
            );
            ", etc."
        );
        CONCATENATEX(
            VALUES('Planning'[Field]);
            'Planning'[Field];
            " & ";
            'Planning'[Field];
            ASC
        )
    )

 

 

 

I appreciate your help, have a nice day!

 

 

2 ACCEPTED SOLUTIONS

Hi @Anonymous ,

 

I got this working by creating a measure as shown below:

 

new Check =
var total = CALCULATE(COUNT(ColorSample[color]), ALL(ColorSample[color]))
RETURN
IF(HASONEVALUE(ColorSample[color]), SELECTEDVALUE(ColorSample[color]), IF(COUNT(ColorSample[color]) > 1 && COUNT(ColorSample[color]) < total, CONCATENATEX(VALUES(ColorSample[color]), ColorSample[color], UNICHAR(10)) , "All Selected"))
 
NOTE: "ColorSample[color]" is my color columns with different color values. Replace this with your column.
 
Move this measure to your card visual. You get as follows:
 
1. when selected few values from slicer:
color1.png
2. When everything is selected:
color2.png
 
Hope this works for you.
If it works please mark this as a solution 🙂
 
Thanks,
Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

HI @Anonymous 

 

Just modify the measure to the following:

 

new Check = var total = CALCULATE(COUNT(ColorSample[color]), ALL(ColorSample[color])) RETURN IF(HASONEVALUE(ColorSample[color]), SELECTEDVALUE(ColorSample[color]), IF(COUNT(ColorSample[color]) > 1 && COUNT(ColorSample[color]) < total, CONCATENATEX(VALUES(ColorSample[color]), CONCATENATE(ColorSample[color], ","), UNICHAR(10)) , "All Selected"))
 
This will work and give you desired output.
 
I generally use https://docs.microsoft.com/en-us/dax/ to refer to DAX functions in Power BI.
 
Give Kudos and accept as a solution! 🙂
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

5 REPLIES 5
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you add some screenshots on how this looks in Power BI report - your card visual with the slicer value selection?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi @Pragati11  ,

 

Sure, I just came up with a quick example:

 

When only a few filters are selected it would show the card like this:

Card and Slicer (without word wrap)Card and Slicer (without word wrap)

Here I would prefer it, if every selected filter would start on a new line like this (in the card):

 

Black

Blue

Green

Grey

 

When all filters (or no filters) are selected it looks like below. In this case I'd like the card to say "All colors".

Card and slicer (all selected)Card and slicer (all selected)

Does this help you?

Thank you for your help!

Hi @Anonymous ,

 

I got this working by creating a measure as shown below:

 

new Check =
var total = CALCULATE(COUNT(ColorSample[color]), ALL(ColorSample[color]))
RETURN
IF(HASONEVALUE(ColorSample[color]), SELECTEDVALUE(ColorSample[color]), IF(COUNT(ColorSample[color]) > 1 && COUNT(ColorSample[color]) < total, CONCATENATEX(VALUES(ColorSample[color]), ColorSample[color], UNICHAR(10)) , "All Selected"))
 
NOTE: "ColorSample[color]" is my color columns with different color values. Replace this with your column.
 
Move this measure to your card visual. You get as follows:
 
1. when selected few values from slicer:
color1.png
2. When everything is selected:
color2.png
 
Hope this works for you.
If it works please mark this as a solution 🙂
 
Thanks,
Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Thank you very much for your help, @Pragati11  !

I copied the measure and it works great. Would the measure need to be change lot, if I also would like to have have a comma (or &) after each selected filter, except the last?

 

Yellow,

Orange,

Red

 

By the way, would you recommend any websites or other resources for learning about Power BI or DAX?

 

Thanks again.

HI @Anonymous 

 

Just modify the measure to the following:

 

new Check = var total = CALCULATE(COUNT(ColorSample[color]), ALL(ColorSample[color])) RETURN IF(HASONEVALUE(ColorSample[color]), SELECTEDVALUE(ColorSample[color]), IF(COUNT(ColorSample[color]) > 1 && COUNT(ColorSample[color]) < total, CONCATENATEX(VALUES(ColorSample[color]), CONCATENATE(ColorSample[color], ","), UNICHAR(10)) , "All Selected"))
 
This will work and give you desired output.
 
I generally use https://docs.microsoft.com/en-us/dax/ to refer to DAX functions in Power BI.
 
Give Kudos and accept as a solution! 🙂
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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