Forum Discussion

Puja's avatar
Puja
Icon for Helper III rankHelper III
3 years ago
Solved

Need help with DAX

Hello All,

Please, I need some help with DAX (not in PQ)

I have a table below

DATE        TypeA   TypeB
1/16/2021  A           B
1/30/2021  A           B
2/13/2021  A           B
2/27/2021  A           B
3/20/2021  A           B

 

Is there a way I can get a format like this using DAX?

1/30/2021A

DATETYPE

1/16/2021

A
2/13/2021A
2/27/2021A
3/20/2021A

1/16/2021

B
1/30/2021B
2/13/2021B
2/27/2021B
3/20/2021B

 

Thank you

  • hi Puja 

    try like:

    Table =
    UNION
    (
        SELECTCOLUMN(
           TableName,
           "Date", TableName[Date],
           "A", TableName[A]
        ),
        SELECTCOLUMN(
           TableName,
           "Date", TableName[Date],
           "B", TableName[B]
        )
    )

6 Replies

  • hi Puja 

    try like:

    Table =
    UNION
    (
        SELECTCOLUMN(
           TableName,
           "Date", TableName[Date],
           "A", TableName[A]
        ),
        SELECTCOLUMN(
           TableName,
           "Date", TableName[Date],
           "B", TableName[B]
        )
    )
  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Puja 

    how many types do you have? Any columns other than date and type are required?

    • Puja's avatar
      Puja
      Icon for Helper III rankHelper III

      Hi tamerj1 ,

      Yes, I do have other columns like Month and Year.

      Also, I want the reqested format in the same table.

       

      TIA

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

        Puja 

        Would you please update the provided sample perhaps with more realistic data?