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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
Microsoft Employee
Microsoft 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors