Forum Discussion

Neel98's avatar
Neel98
Frequent Visitor
3 years ago
Solved

DAX: Pivot column

Hi,
I need to create the pivoted column in Dax. Here I have attached the sample data. My dataset has a Number, date and value column. The final output will be Number and two date fields. Is this possible in DAX?

 

  • Neel98 

    Please try

    NewTable =
    ADDCOLUMNS (
    VALUES ( 'Table'[Number] ),
    "5-Sep", CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Date] = DATE ( 2022, 9, 5 ) ),
    "29-Sep", CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Date] = DATE ( 2022, 9, 29 ) )
    )

3 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Neel98 

    A matrix visual will do or you're looking for a calculated table?

  • Neel98's avatar
    Neel98
    Frequent Visitor

    Thank you. I am looking for a calculated table. 

    • tamerj1's avatar
      tamerj1
      Icon for Community Champion rankCommunity Champion

      Neel98 

      Please try

      NewTable =
      ADDCOLUMNS (
      VALUES ( 'Table'[Number] ),
      "5-Sep", CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Date] = DATE ( 2022, 9, 5 ) ),
      "29-Sep", CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Date] = DATE ( 2022, 9, 29 ) )
      )