Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
My data looks like this:
but I want it to look like this:
For the life of me I can't do it in Edit Queries.
Cant seem to add a sample .pbix file.
Solved! Go to Solution.
Try this:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jZZNaxwxDIb/SthzDpK/xnMslIQspAltbyGHzTKkhc0H091A/n22ENqV7NGr24Aev3otyfbc3a2Iz262+5eHaT4LxHV1vrr9viYizsdPXt2fLyKcGCIUEUIx4EQVImU4Rb69vE1PTaZKkOEUMZOLg6mYiSNmBrwvVeQFRuT6Om17ntMps948Hzbz+19k/I+MEJFuuogs8sX0MHcYggxVrEOyWf1csjh9ZnToDNizauj1Zt7+shK1AA0VKMi56gAlASCzDQRCHuR5/PI6/96pOjAA5Bx1ALmLFgiUgUIFHgITSgFMBoYpAipUQQqwDhUpgBTqZugASU3Uu3JQzHCoVli1qQnLU6fD6n1pcvNoh01rgQfTWjKtqXunca4Pur6R7NWj2RKWd2ezsSicrw/Pk4onM67ev3a9LHsbJ7Qe+AtAX57LJq5+f9r9ka2veteuT6B+sSzFL69+Hkf+uAUgAAzmxQS9+7ldH1X+nT7y1Y7HbMbVqW7Xh2jHEwN9O94MUKMP/OkGNvqgPkG+C4fHw5+9JAohIhlEd4w6ImqQemnigAjGGhUQ6mev51SeqR6RkUYg6DRnSKB6qMv3x/S6//c7fiKTHFDyKKXgSTd6oMGTzqWUTag7ngtS0Zb6hNgBBY9zeXKXIE9fgmd37PFEHk9EDqg4PLGnLeoJW1Ly7M6jFMondP8B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Reference = _t, Custom = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Reference", type text}, {"Custom", Int64.Type}}), #"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"Month", each Date.MonthName(_), type text}}), #"Extracted First Characters" = Table.TransformColumns(#"Extracted Month Name", {{"Month", each Text.Start(_, 3), type text}}), #"Pivoted Column" = Table.Pivot(#"Extracted First Characters", List.Distinct(#"Extracted First Characters"[Month]), "Month", "Custom", List.Sum) in #"Pivoted Column"
A very easy way without having to see the code. In query, just select your month column and click on 'pivot'
Select your column and click on 'pivot'.
A very easy way without having to see the code. In query, just select your month column and click on 'pivot'
Select your column and click on 'pivot'.
Hey @Anonymous ,
if you don't want to do it in Power Query.
If this post was helpful may I ask you to mark it as solution and give it some kudos?
Have a nice day!
BR,
Josef
Thanks Josef - that would work, however I need it in that format in a data table so I can create additional columns from it i.e. time between each point etc.
Thanks.
Ok then I would create a calculated table -> by using the ADDCOLUMNS Function where I have my months hardcoded and in the expression there is a certain measure.
I just don't understand why you are not using the PowerQuery Editor. It would be so much easier...
BR,
Josef
sorry - I don't think I've made it clear.
I want to do it in PowerQuery / Edit Queries - but cannot work out how to do it.
Thanks.
Hey @Anonymous ,
you extract the month information out of your column. I bet you can do that without further explanation 😉
And then you do this (its a diffrent example but the principle is the same)
Explanation
thanks again Josef, but still not quite there.
I've uploaded a sample to play with.
https://drive.google.com/open?id=1WKA2405CSdB7WecOEAvJdQ4k2HUkGzuF
Or this like what @JosefPrakljacic suggested:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jZZNaxwxDIb/SthzDpK/xnMslIQspAltbyGHzTKkhc0H091A/n22ENqV7NGr24Aev3otyfbc3a2Iz262+5eHaT4LxHV1vrr9viYizsdPXt2fLyKcGCIUEUIx4EQVImU4Rb69vE1PTaZKkOEUMZOLg6mYiSNmBrwvVeQFRuT6Om17ntMps948Hzbz+19k/I+MEJFuuogs8sX0MHcYggxVrEOyWf1csjh9ZnToDNizauj1Zt7+shK1AA0VKMi56gAlASCzDQRCHuR5/PI6/96pOjAA5Bx1ALmLFgiUgUIFHgITSgFMBoYpAipUQQqwDhUpgBTqZugASU3Uu3JQzHCoVli1qQnLU6fD6n1pcvNoh01rgQfTWjKtqXunca4Pur6R7NWj2RKWd2ezsSicrw/Pk4onM67ev3a9LHsbJ7Qe+AtAX57LJq5+f9r9ka2veteuT6B+sSzFL69+Hkf+uAUgAAzmxQS9+7ldH1X+nT7y1Y7HbMbVqW7Xh2jHEwN9O94MUKMP/OkGNvqgPkG+C4fHw5+9JAohIhlEd4w6ImqQemnigAjGGhUQ6mev51SeqR6RkUYg6DRnSKB6qMv3x/S6//c7fiKTHFDyKKXgSTd6oMGTzqWUTag7ngtS0Zb6hNgBBY9zeXKXIE9fgmd37PFEHk9EDqg4PLGnLeoJW1Ly7M6jFMondP8B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Reference = _t, Custom = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Reference", type text}, {"Custom", Int64.Type}}), #"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"Month", each Date.MonthName(_), type text}}), #"Extracted First Characters" = Table.TransformColumns(#"Extracted Month Name", {{"Month", each Text.Start(_, 3), type text}}) in #"Extracted First Characters"
Try this:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jZZNaxwxDIb/SthzDpK/xnMslIQspAltbyGHzTKkhc0H091A/n22ENqV7NGr24Aev3otyfbc3a2Iz262+5eHaT4LxHV1vrr9viYizsdPXt2fLyKcGCIUEUIx4EQVImU4Rb69vE1PTaZKkOEUMZOLg6mYiSNmBrwvVeQFRuT6Om17ntMps948Hzbz+19k/I+MEJFuuogs8sX0MHcYggxVrEOyWf1csjh9ZnToDNizauj1Zt7+shK1AA0VKMi56gAlASCzDQRCHuR5/PI6/96pOjAA5Bx1ALmLFgiUgUIFHgITSgFMBoYpAipUQQqwDhUpgBTqZugASU3Uu3JQzHCoVli1qQnLU6fD6n1pcvNoh01rgQfTWjKtqXunca4Pur6R7NWj2RKWd2ezsSicrw/Pk4onM67ev3a9LHsbJ7Qe+AtAX57LJq5+f9r9ka2veteuT6B+sSzFL69+Hkf+uAUgAAzmxQS9+7ldH1X+nT7y1Y7HbMbVqW7Xh2jHEwN9O94MUKMP/OkGNvqgPkG+C4fHw5+9JAohIhlEd4w6ImqQemnigAjGGhUQ6mev51SeqR6RkUYg6DRnSKB6qMv3x/S6//c7fiKTHFDyKKXgSTd6oMGTzqWUTag7ngtS0Zb6hNgBBY9zeXKXIE9fgmd37PFEHk9EDqg4PLGnLeoJW1Ly7M6jFMondP8B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Reference = _t, Custom = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Reference", type text}, {"Custom", Int64.Type}}), #"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"Month", each Date.MonthName(_), type text}}), #"Extracted First Characters" = Table.TransformColumns(#"Extracted Month Name", {{"Month", each Text.Start(_, 3), type text}}), #"Pivoted Column" = Table.Pivot(#"Extracted First Characters", List.Distinct(#"Extracted First Characters"[Month]), "Month", "Custom", List.Sum) in #"Pivoted Column"
Why you cant do it in Power Query?
appreciate your feedback, but your comment isn't very helpful.
I've tried all sorts of ways of cutting it, but can't get the data to look like the sample.
Any suggestions?
User | Count |
---|---|
90 | |
73 | |
71 | |
59 | |
53 |
User | Count |
---|---|
42 | |
41 | |
34 | |
32 | |
31 |