cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Zal Frequent Visitor
Frequent Visitor

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
1 ACCEPTED SOLUTION

Accepted Solutions
Zal Frequent Visitor
Frequent Visitor

Re: Create Table from

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

 

Regards

Zal

3 REPLIES 3
Super User
Super User

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
Super User

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

Re: Create Table from

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

 

Regards

Zal