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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ma_azj24
Frequent Visitor

DirectQuery Transpose Column Data to Multiple Rows via SQL

Hi, I'm working with a dataset from SAP HANA and am storing the database via DirectQuery. I have been transforming the table output via SQL but need help with returning values from the "Scheduled" column based on the "Category" as new columns.

 

From

DateVehicle CodeFrom LocTo LocCategoryScheduled
21/05/2024Q123SYDBNEDepart21/05/2024 10:00
21/05/2024Q123SYDBNEArrive21/05/2024 11:00
21/05/2024Q123OOLBNEDepart21/05/2024 09:00
21/05/2024Q123OOLBNEArrive21/05/2024 10:00

 

To

DateVehicle CodeFrom LocTo LocDepartArrive
21/05/2024Q123SYDBNE21/05/2024 10:0021/05/2024 11:00
21/05/2024Q123OOLBNE21/05/2024 09:0021/05/2024 10:00
2 REPLIES 2
amitchandak
Super User
Super User

@ma_azj24 , If you want to do that in Power Query (Unpivot column) and this table will become import mode table

 

of you can create you use measures

calculate(  Min(Table[Scheduled]), filter(Table, Table[Category] = "Depart" ) )

 

calculate(  Min(Table[Scheduled]), filter(Table, Table[Category] = "Arrive" ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for suggesting a solution. Unfortunately, I am required to use DirectQuery so using Power Query to transform the data is not an option for me. I will keep this in mind for my import mode datasets! 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.