cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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"

I have book! Learn Power BI from Packt


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

Proud to be a Datanaut!

Highlighted
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

Helpful resources

Announcements
Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 130 members 1,880 guests
Please welcome our newest community members: