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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mtiller12
New Member

Working with mixed data

I am struggling to manipulate a data source that has disparate data fields grouped into single columns and tagged with corresponding unique recordids.  Below is an example dataset of what I have coming in:

 

Fieldvaluetextfieldnamerecordid
2017Year1
Q1Quarter1
Q12017 NoteUpdate1
2017Year2
Q2Quarter2
Q22017 NoteUpdate2
2017Year3
Q3Quarter3
Q32017 NoteUpdate3
2017Year4
Q4Quarter4
Q42017 NoteUpdate4
2018Year5
Q1Quarter5
Q12018 NoteUpdate5
2018Year6
Q2Quarter6
Q22018 NoteUpdate6
2018Year7
Q3Quarter7
Q32018 NoteUpdate7
2018Year8
Q4Quarter8
Q42018 NoteUpdate8

 

 

I am trying to be able to display and filter based on the different Fieldname categories.  An example visualation I would like to have is something simple, as shown below:

YearQuarterUpdate
2017Q1Q12017 Note
2017Q2Q22017 Note
2017Q3Q32017 Note
2017Q4Q42017 Note
2018Q1Q12018 Note
2018Q2Q22018 Note
2018Q3Q32018 Note
2018Q4Q42018 Note

 

I feel like there should be a relativley simple way to address this, but for the life of me I cannot figure out a way to do it.  Any help would be greatly appreciated!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdA7DsMgEATQq1hbuwh/TmHJhQsLUSCFOhFy7m8ShDaIqVjNsq+YEEg+hKOVzpxKfQTFNdAu6rh/Urnyf/j9umyvK9fseD/Tb2jLUZHtQA5KD6EigaLagRqUHkJFAUW3Az0oPYSK7opnxaBeDPfiJ8UAxaJeLPcyKxYoDvXiuJdZcUDxqBfPvcxKXcYb", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Fieldvaluetext = _t, fieldname = _t, recordid = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fieldvaluetext", type text}, {"fieldname", type text}, {"recordid", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[fieldname]), "fieldname", "Fieldvaluetext")
in
    #"Pivoted Column"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdA7DsMgEATQq1hbuwh/TmHJhQsLUSCFOhFy7m8ShDaIqVjNsq+YEEg+hKOVzpxKfQTFNdAu6rh/Urnyf/j9umyvK9fseD/Tb2jLUZHtQA5KD6EigaLagRqUHkJFAUW3Az0oPYSK7opnxaBeDPfiJ8UAxaJeLPcyKxYoDvXiuJdZcUDxqBfPvcxKXcYb", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Fieldvaluetext = _t, fieldname = _t, recordid = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fieldvaluetext", type text}, {"fieldname", type text}, {"recordid", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[fieldname]), "fieldname", "Fieldvaluetext")
in
    #"Pivoted Column"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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