Forum Discussion

charleshale's avatar
charleshale
Icon for Continued Contributor rankContinued Contributor
3 years ago
Solved

Resources for basic Dax Group By Concatenating Values

Does anyone have any resources or guides for how to achieve the equivalent to M Query's Group By in DAX with turning a secondary column into a list of values?   I'm not seeing how to do that in guide...
  • vicky_'s avatar
    3 years ago

    you can try something like:

    Table = ADDCOLUMNS(VALUES([email]), "Accessed From", CONCATENATEX(Table, [Accessed From], "|"))
  • danextian's avatar
    3 years ago

    As a calculated table:

    Table2 =
    SUMMARIZE (
        'Table',
        'Table'[Email],
        "Accessed From",
            CONCATENATEX (
                VALUES ( 'Table'[Accessed From] ),
                'Table'[Accessed From],
                " | "
            )
    )
    
  • charleshale's avatar
    3 years ago

    Update - this code fixed the problem

     

    a_usacities_sum =
    ADDCOLUMNS(
        DISTINCT(
            SUMMARIZE(a_uscities, a_uscities[city], a_uscities[Count Dupes])),
        "States",
        VAR _city = a_uscities[city]
        RETURN
        CALCULATE(
            CONCATENATEX(VALUES ( 'a_uscities'[state_id] ),
                'a_uscities'[state_id],
                " | "),
                a_uscities[city] = _city)
    )