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
Anonymous
Not applicable

Pivot Live Direct Query Data

I appologize if I am not using the correct terms so please bear with me.

 

I am using a direct query link to a SQL server of a pull of data that stores the data in vertical table instead of a horizonal field.  Meaning instead of having one row for an entry and several columns for each 'question' it saves each question for an entry as a different row so one entry could be 10 rows.  Is there a way to change this, pivot it, to make the entries show as one row and the columns are the 'questions'?  Keep in mind this is a direct query from the source.

 

Also going to the source to do this before I get the data is not an option as of yet, that is why I am here.

 

Thank you for any and all help.

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

You use direct Query mode, the data is not imported into Power BI, and there are many limitations about direct mode. You'd better use SQL Code to get expected data as above said. Could you please mark reply as answer if you think it's helpful.

Thanks,
Angelia

View solution in original post

4 REPLIES 4
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

You can use SQL functions PIVOT and UNPIVOT in SSMS and debug it to get expected result. When you type it in box highlighted in red line. You will load desired table.

1.PNG

Best Regards,
Angelia

Anonymous
Not applicable

I will give this a try but not familiar with SQL code.  I was hoping to be able to do it in Power BI but will look into this route.  Thanks

 

Hi @Anonymous,

You use direct Query mode, the data is not imported into Power BI, and there are many limitations about direct mode. You'd better use SQL Code to get expected data as above said. Could you please mark reply as answer if you think it's helpful.

Thanks,
Angelia

Anonymous
Not applicable

I am still checking into this and waiting to see if there might be other ways to get this done, but am still looking into the SQL PIVOT.  Thanks

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.