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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ganes
Helper I
Helper I

Transpose multiple rows in to multiple columns in Directquery

 

Hi All,

can anyone please help me to transpose question colum into rows. And it should have its correseponding answer. I am pulling data from bigquery.

column 1 (Number) has 5 entries for 5 diff questions and corresponding answers. I need the 5 questions in indivisual column and its answers get filled in as per the number

ganes_0-1705764986820.png

 

1 ACCEPTED SOLUTION

load the data as is, and put the question field in the columns area of your matrix visual.

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

You can achieve this result 

dufoq3_0-1705872954526.png

using UI:

dufoq3_1-1705873143984.png

or create Blank Query and paste there this code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdG9aoJBFIThe/lqC8/M+Fd6CUkrYmVhYyAmePtJILCLHGa6Xd5TzXM6Le+1rJa37+vj6/Zxv/x9jvfH8/r5+zyvXjNGRpM5MpuskdXkzcibJm9H3jZ5N/KuyfuR900+jHxocq2nXdbdwTxct1xN01W3XU3jVbdeTfNVt19NA1a3YE0T1v+G8Prw+vD68Prw+vD68Prw+vD6SPpI+kj6SPpI+kj6SPr0+vT69Pr0+vT69Pr0+vT69PpM+kz6TPpM+kz6TPpM+vL68vry+vL68vry+vL68vry+kr6SvpK+kr6SvpK+nL65x8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t, Question = _t, Answer = _t]),
    #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Question]), "Question", "Answer")
in
    #"Pivoted Column"

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

lbendlin
Super User
Super User

Consider doing that in the UI instead.

Hi @lbendlin Can you please explain How that can be acheived ?

load the data as is, and put the question field in the columns area of your matrix visual.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors