Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm trying to create a matrix table to work with in my report e.a. in my charts.
See below's example. On the left my current table and on the right the result I want. I've tried a few things in the query editor and using DAX. However, I did not get the result I want. I know I can create such a table easely in my report but then I cannot use is in other visuals.
The categories are dynamic so I cannot hard code these columns names.
Can someone help me out?
Solved! Go to Solution.
Hi @SanderBI ,
As @Anonymous , we can pivot your table in power query. Here I create one sample for your reference. M code as below.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQ0lFyBGJDpVgdFEEnIDZCF3QGYmOooBGydhN0QZB2U3RBkHYzpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Dates = _t, Categories = _t, Values = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Dates", type date}, {"Categories", type text}, {"Values", Int64.Type}}), #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Categories]), "Categories", "Values", List.Sum) in #"Pivoted Column"
Pbix as attached.
Regards,
Frank
Hi @SanderBI ,
As @Anonymous , we can pivot your table in power query. Here I create one sample for your reference. M code as below.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQ0lFyBGJDpVgdFEEnIDZCF3QGYmOooBGydhN0QZB2U3RBkHYzpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Dates = _t, Categories = _t, Values = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Dates", type date}, {"Categories", type text}, {"Values", Int64.Type}}), #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Categories]), "Categories", "Values", List.Sum) in #"Pivoted Column"
Pbix as attached.
Regards,
Frank
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
45 |