Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Puja
Helper III
Helper III

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

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Puja 

try like:

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

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @Puja 

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

Hi @tamerj1 ,

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

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

 

TIA

@Puja 

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

Hi @tamerj1 ,

Below solution helped. Thank you for looking into it.

FreemanZ
Super User
Super User

hi @Puja 

try like:

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

Thank you @FreemanZ  🙂

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.