Forum Discussion

plantew1's avatar
plantew1
Icon for Helper I rankHelper I
2 years ago
Solved

Concatenate on Duplicate

Hello everyone. I have written the measure shown below. I get the following duplicated Rank values. What I would like to do is concatenate the CIS Type Description value when a Rank is duplicated. I...
  • TheoC's avatar
    2 years ago

    Hi plantew1 

     

    Can you try the below? 

     

     

    CIS - Rank CIS Types with Concatenation =
    VAR _Ranking = 
    SUMMARIZE(
        ALL ( 'Lookup: CI Types' ) ,
        'Lookup: CI Types'[CIS Type ID] ,
        "Rank" , RANKX (
            ALL ( 'Lookup: CI Types'[CIS Type ID] ) ,
            SUMX (
                FILTER (
                    ALL ( 'Lookup: CI Types'[CIS Type Description] ) ,
                    NOT ( 'Lookup: CI Types'[CIS Type Description] ) IN { "Criteria One", "Criteria Two" }
                ) ,
                [CIS - Intake Count by CI Type-Subtype Current Month]
            ) ,
            , DESC , Skip
        ) ,
        "TypeDesc" , 'Lookup: CI Types'[CIS Type Description]
    )
    
    VAR _ConcatenateTypes = 
    CALCULATE (
        CONCATENATEX (
            FILTER (
                _Ranking ,
                [Rank] = EARLIER ( [Rank] )
            ) ,
            [TypeDesc] , ", " ) , 
            REMOVEFILTERS ( 'Lookup: CI Types'[CIS Type ID] )
    )
    
    RETURN
    IF (
        COUNTROWS (
            FILTER (
                _Ranking ,
                [Rank] = EARLIER ( [Rank] )
            )
        ) > 1 ,
        _ConcatenateTypes ,
        MAX ( 'Lookup: CI Types'[CIS Type Description] )
    )

     

    Hope this works... let me know how it goes.

     

    Theo