Forum Discussion

ppgandhi11's avatar
ppgandhi11
Helper V
7 years ago
Solved

DAX formula help self join

Hi,   I am trying to obtain below recordset using DAX formulas. How would get to it?   Logic: Provider 1 is associated with Specialty A. So all the providers associated with A becomes RelatedPro...
  • LivioLanzo's avatar
    7 years ago

    Does this do what you want?

     

     

     

     

    =
    GENERATE (
        VALUES ( Providers[Provider] ),
        VAR Specialties =
            CALCULATETABLE ( VALUES ( Providers[Specialty] ) )
        RETURN
            SELECTCOLUMNS (
                CALCULATETABLE (
                    VALUES ( Providers[Provider] ),
                    TREATAS ( Specialties, Providers[Specialty] ),
                    ALL ( Providers[Provider] )
                ),
                "RelatedProviders", [Provider]
            )
    )