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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
titanic123
Helper I
Helper I

convert multiple rows into single row

Hi All, I have date like below, I need to convert multiple rows into single row by ID

 

ID   Visit_Date

101  01/10/2023

101  01/15/2023

101 01/23/2023

102 01/18/2023

102  02/23/2023

 

I need data as 
ID  Visit_Date1  Visit_Date2  Visit_Date3

101 01/10/2023  01/15/2023 01/23/2023
102 01/18/2023  02/23/2023

 

Please help me how to summarize using DAX.

3 ACCEPTED SOLUTIONS
gmsamborn
Solution Sage
Solution Sage

Hi @titanic123 

 

If I understand correctly, by adding a calculated column like below it could be used in columns of a matrix.

 

Visit No = 
    COUNTROWS(
        FILTER(
            ALL( 'Visits' ),
            'Visits'[ID] = EARLIER( 'Visits'[ID] )
                && 'Visits'[Visit_Date] <= EARLIER( 'Visits'[Visit_Date] )
        )
    )

 

Visit No.pbix

 

Let me know if this doesn't help.

View solution in original post

Ritaf1983
Super User
Super User

@titanic123 

You can add a calculated column with DAX :

Visit_rank = "Visit_"&RANKX(FILTER('Table','Table'[ID ]=EARLIER('Table'[ID ])),'Table'[ Visit_Date],,ASC)
Ritaf1983_0-1698296009378.png

and use this column in the matrix

Ritaf1983_1-1698296088455.png

Pbix is attached.

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

 

View solution in original post

v-binbinyu-msft
Community Support
Community Support

Hi @titanic123 ,

Could you please tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best regards,
Community Support Team_Binbin Yu

View solution in original post

4 REPLIES 4
titanic123
Helper I
Helper I

Thanks a lot for the quick response, Both worked correctly.

v-binbinyu-msft
Community Support
Community Support

Hi @titanic123 ,

Could you please tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best regards,
Community Support Team_Binbin Yu

Ritaf1983
Super User
Super User

@titanic123 

You can add a calculated column with DAX :

Visit_rank = "Visit_"&RANKX(FILTER('Table','Table'[ID ]=EARLIER('Table'[ID ])),'Table'[ Visit_Date],,ASC)
Ritaf1983_0-1698296009378.png

and use this column in the matrix

Ritaf1983_1-1698296088455.png

Pbix is attached.

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

 
gmsamborn
Solution Sage
Solution Sage

Hi @titanic123 

 

If I understand correctly, by adding a calculated column like below it could be used in columns of a matrix.

 

Visit No = 
    COUNTROWS(
        FILTER(
            ALL( 'Visits' ),
            'Visits'[ID] = EARLIER( 'Visits'[ID] )
                && 'Visits'[Visit_Date] <= EARLIER( 'Visits'[Visit_Date] )
        )
    )

 

Visit No.pbix

 

Let me know if this doesn't help.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors