Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Turning columns into rows in DAX

Hi everyone,   I'm sure this is a well known topic and I'm aware this is much easier done in Power Query. The issue is that the data I am attempting to pivot is obtained from calculated columns in ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous 

    You can refer to the following code

    Table 2 =
    VAR a =
        SUMMARIZE ( FILTER ( 'Table', [Date 1 ] <> BLANK () ), [Date 1 ], [Hours ] )
    VAR b =
        SUMMARIZE (
            FILTER ( 'Table', [Date 2] <> BLANK () ),
            'Table'[Date 2],
            'Table'[Hours ]
        )
    VAR c =
        SUMMARIZE (
            FILTER ( 'Table', [Date 3] <> BLANK () ),
            [Date 3],
            'Table'[Hours ]
        )
    RETURN
        UNION ( a, b, c )
    

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.