Reply
Zal Frequent Visitor
Frequent Visitor
Posts: 2
Registered: ‎02-02-2018
Accepted Solution

Create Table from

Hi,

 

This is my first post. I'm trying to create a table from the "starting point" to the "Final" below.

Could you guide. I've tried adding a count column and do an unpivot/Pivot. Nothing is working.

If you have any idea that would be great.

 

Starting point

SalesAccountRole
JulienAccount 1Inside Sales
JulienAccount 2Inside Sales
MichaelAccount 1Territory Sales
MichaelAccount 2Territory Sales
MichaelAccount 3Territory Sales

  

Final

AccountInside SalesTerritory Sales
Account 1JulienMichael
Account 2JulienMichael
Account 3 Michael

Accepted Solutions
Zal Frequent Visitor
Frequent Visitor
Posts: 2
Registered: ‎02-02-2018

Re: Create Table from

@Greg_Deckler Thanks a lot. That answer to my question.

 

Regards

Zal

View solution in original post


All Replies
Highlighted
Super User
Posts: 10,531
Registered: ‎07-11-2015

Re: Create Table from

Hooray!! I think I finally figured one of these out!! @ImkeF are you proud of me!?!?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8irNyUzNU9JRckxOzi/NK1EwBLI984ozU1IVghNzUouVYnWwqDLCpso3MzkjMTUHzbCQ1KKizJL8okq8Ko2IVmmMTWUsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Sales = _t, Account = _t, Role = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Sales", type text}, {"Account", type text}, {"Role", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Role]), "Role", "Sales")
in
    #"Pivoted Column"

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

Proud to be a Datanaut!


Super User
Posts: 1,620
Registered: ‎09-06-2015

Re: Create Table from

Definitely Smiley Wink

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




Zal Frequent Visitor
Frequent Visitor
Posts: 2
Registered: ‎02-02-2018

Re: Create Table from

@Greg_Deckler Thanks a lot. That answer to my question.

 

Regards

Zal