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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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