Forum Discussion

SabineOussi's avatar
SabineOussi
Skilled Sharer
5 years ago
Solved

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...
  • AlB's avatar
    5 years ago

    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 

  • AlB's avatar
    5 years ago

    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