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 in direct Query

Hi All,

 

I am using direct query to get data from database. Below is requriment 

Input Table 

Seq_#NameFlag
1A101
1B102
1C103
2D101
2E102
3F101
3G102
3H103
3I104

 

Output required

Seq_#Flag_101Flag_102Flag_103Flag_104
1ABCNULL
2DENULLNULL
3FGHI

 

can any tell me how write dax expressions to give desired output .

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Here is my table in Power Query. The only  thing I did was to change all columns to text.

Change Type.PNG

 

Select the flag column. Go to the Transform tab, click on Pivot Column, select Name as the Values Column. Go to the advance options and select don't aggregate. You will see the following.

 

Pivot.PNGIf this solves your issue, please mark this reply as the solution. Kudos are nice too!

@Nathaniel_C 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Nathaniel_C
Super User
Super User

tableFlagtable.PNG

Drop each column into a matrix as follows:

rows.PNG

for this solution.

Ifsolution flag.PNG

this solves your issue, please

mark it as a solution.  Kudos are nice too!

 

@Nathaniel_C 

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

i want the data to be transpose in the table level but not in the visualization level . 

Hi @Anonymous ,

 

Here is my table in Power Query. The only  thing I did was to change all columns to text.

Change Type.PNG

 

Select the flag column. Go to the Transform tab, click on Pivot Column, select Name as the Values Column. Go to the advance options and select don't aggregate. You will see the following.

 

Pivot.PNGIf this solves your issue, please mark this reply as the solution. Kudos are nice too!

@Nathaniel_C 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




aeriel_0-1674650376795.png

this solution is not working in DirectQuery bro! @Nathaniel_C 

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.