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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
SabineOussi
Skilled Sharer
Skilled Sharer

CONCATENATEX Empty Records

Hello Community,

 

I am trying to create a measure that concatenates both columns and measure and it seems that I am missing a grouping somewhere so it is not returning the desired output.

 

Here is my available data

Data.PNG

 

This is the concatenation measure I have created

 

CONCAT = 
CONCATENATEX(
    VALUES('Table'[Column1]), 'Table'[Column1] &" ("&
    CONCATENATEX(
        VALUES('Table'[Column2]),
        'Table'[Column2] &" "& FORMAT([Measure1], "0%") &" ["& [Measure2] &"]",
        ", ",
        'Table'[Column2], ASC
    ) &")", "
    ")

 

 

It is returning results for records that don't exist, for example:
- Area1 Section3 doesn't have any Column2 with values A, B, C, or D.

- Area2 Section4 doesn't have any Column2 with value A or K.

Output.PNG

 

Adding a condition on either measure1 or measure2 didn't solve the issue.

 

Any thoughts on this?

 

Thank you,

Sabine O.

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

Hi @SabineOussi 

What would the expected result be?

Try this

CONCAT =
CONCATENATEX (
    VALUES ( 'Table'[Column1] ),
    'Table'[Column1] & " ("
        & CALCULATE (
            CONCATENATEX (
                VALUES ( 'Table'[Column2] ),
                'Table'[Column2] & " "
                    & FORMAT ( [Measure1], "0%" ) & " [" & [Measure2] & "]",
                ", ",
                'Table'[Column2], ASC
            )
        ) & ")",
    "
"
)

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

AlB
Community Champion
Community Champion

@SabineOussi 

Ok. It's clear now. It took some changing. Try this:

 

CONCAT7 =
CONCATENATEX (
    FILTER (
        ADDCOLUMNS (
            VALUES ( 'Table'[Column1] ),
            "aux_",
                CALCULATE (
                    CONCATENATEX (
                        FILTER ( VALUES ( 'Table'[Column2] ), [Measure1] <= 0.03 ),
                        'Table'[Column2] & " "
                            & FORMAT ( [Measure1], "0%" ) & " [" & [Measure2] & "]",
                        ", ",
                        'Table'[Column2], ASC
                    )
                )
        ),
        [aux_] <> ""
    ),
    'Table'[Column1] & " (" & [aux_] & ")",
    UNICHAR ( 10 )
)

 

Also note that I've used UNICHAR(10) for the line break, which I find more convenient.

 

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

10 REPLIES 10
AlB
Community Champion
Community Champion

@SabineOussi 

Ok. It's clear now. It took some changing. Try this:

 

CONCAT7 =
CONCATENATEX (
    FILTER (
        ADDCOLUMNS (
            VALUES ( 'Table'[Column1] ),
            "aux_",
                CALCULATE (
                    CONCATENATEX (
                        FILTER ( VALUES ( 'Table'[Column2] ), [Measure1] <= 0.03 ),
                        'Table'[Column2] & " "
                            & FORMAT ( [Measure1], "0%" ) & " [" & [Measure2] & "]",
                        ", ",
                        'Table'[Column2], ASC
                    )
                )
        ),
        [aux_] <> ""
    ),
    'Table'[Column1] & " (" & [aux_] & ")",
    UNICHAR ( 10 )
)

 

Also note that I've used UNICHAR(10) for the line break, which I find more convenient.

 

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

 

Perfect.

It returns exactly what I want.

 

Thanks a lot!
Sabine O.

AlB
Community Champion
Community Champion

@SabineOussi 

Try this. You might have to do some minor changes for it to show exactly how you want (spaces, what happens when measure 1 is not shown, etc.) By the way, can you share the pbix? There's something that I would like to try

 

CONCAT =
CONCATENATEX (
    VALUES ( 'Table'[Column1] ),
    'Table'[Column1] & " ("
        & CALCULATE (
            CONCATENATEX (
                VALUES ( 'Table'[Column2] ),
                'Table'[Column2] & " "
                    & IF ( [Measure1] <= 0.03, FORMAT ( [Measure1], "0%" ) ) & " [" & [Measure2] & "]",
                ", ",
                'Table'[Column2], ASC
            )
        ) & ")",
    "
"
)

 

 

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

 

Thanks a lot for your help, the condition added doesn't work on all columns.

You can find the sample pbix here

 

CONCAT: my initial calculation
CONCAT2: empty records removed
CONCAT3: with condition

I'm guessing you want to try variables? 

 

Thanks again,

Sabine O. 

AlB
Community Champion
Community Champion

@SabineOussi 

Help me understand what you exactly mean by:

What if a condition has to be made on one of the measure showing only a certain threshold? Let's say measure1 <=3%

Please show the expected result for this case (at least for a couple of lines) with an explanation. What needs to be shown in the result, what not...

 

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

In my sample file, I want to only show values with measure1<=0.03

Expected result would be:

Area1 | Section1 (C 2% [4], D 1% [3])

Area1 | Section3 (G 2% [2])


Area2 | Section1 (B 2% [1], C 3% [3])

Area2 | Section4 (C 2% [6], D 3% [5])

Area2 | Section5 (K 1% [2])

SabineOussi
Skilled Sharer
Skilled Sharer

@AlB What if a condition has to be made on one of the measure showing only a certain threshold?
Let's say measure1 <=3%

Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AlB
Community Champion
Community Champion

Hi @SabineOussi 

What would the expected result be?

Try this

CONCAT =
CONCATENATEX (
    VALUES ( 'Table'[Column1] ),
    'Table'[Column1] & " ("
        & CALCULATE (
            CONCATENATEX (
                VALUES ( 'Table'[Column2] ),
                'Table'[Column2] & " "
                    & FORMAT ( [Measure1], "0%" ) & " [" & [Measure2] & "]",
                ", ",
                'Table'[Column2], ASC
            )
        ) & ")",
    "
"
)

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

Thank you @AlB 
It is working now.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.