March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Everyone,
I am currently creating a matrix using a multi-select parameter to allow an end-user to create a customized Hierarchy for their own analysis. The parameter works great, however, I have a data field that needs to only be shown at the lowest level (whether that it is just blank or the column disappears does not matter). As you can see in the picture below, "Test 6" is always the lowest field and represents the field where I need the "IRR" field to populate once fully expanded to. Does anyone have a solution to this? I have seen a few for static matrices but the parameter makes things tougher.
Solved! Go to Solution.
Thanks for the reply from lbendlin , please allow me to provide another insight:
Hi, @Jddalberth
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.Then I used the following M language in PowerQuery:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYmMgNgFiU6VYnWiwCIhnBsQWQGxoABY2BivQUTIHYkuQsKFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Test 1" = _t, #"Test 2" = _t, #"Test 3" = _t, #"Test 4" = _t, #"Test 5" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test 1", Int64.Type}, {"Test 2", Int64.Type}, {"Test 3", Int64.Type}, {"Test 4", Int64.Type}, {"Test 5", Int64.Type}}),
#"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
#"Changed Type1" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type any}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}}),
#"Transposed Table" = Table.Transpose(#"Changed Type1"),
#"Added Custom" = Table.AddColumn(#"Transposed Table", "Custom", each List.Max([Column1])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Custom"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Column1", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type2", {"Column1.1"}, {{"Max", each List.Max([Column1.2]), type nullable number}}),
#"Merged Queries" = Table.NestedJoin(#"Grouped Rows", {"Column1.1", "Max"}, #"Changed Type2", {"Column1.1", "Column1.2"}, "Changed Type2", JoinKind.LeftOuter),
#"Expanded Changed Type2" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type2", {"Column2", "Column3", "Column4"}, {"Changed Type2.Column2", "Changed Type2.Column3", "Changed Type2.Column4"}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Expanded Changed Type2", {{"Max", type text}}, "en-US"),{"Column1.1", "Max"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Transposed Table1" = Table.Transpose(#"Merged Columns"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true])
in
#"Promoted Headers"
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Of course, if you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from lbendlin , please allow me to provide another insight:
Hi, @Jddalberth
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.Then I used the following M language in PowerQuery:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYmMgNgFiU6VYnWiwCIhnBsQWQGxoABY2BivQUTIHYkuQsKFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Test 1" = _t, #"Test 2" = _t, #"Test 3" = _t, #"Test 4" = _t, #"Test 5" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test 1", Int64.Type}, {"Test 2", Int64.Type}, {"Test 3", Int64.Type}, {"Test 4", Int64.Type}, {"Test 5", Int64.Type}}),
#"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
#"Changed Type1" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type any}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}}),
#"Transposed Table" = Table.Transpose(#"Changed Type1"),
#"Added Custom" = Table.AddColumn(#"Transposed Table", "Custom", each List.Max([Column1])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Custom"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Column1", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type2", {"Column1.1"}, {{"Max", each List.Max([Column1.2]), type nullable number}}),
#"Merged Queries" = Table.NestedJoin(#"Grouped Rows", {"Column1.1", "Max"}, #"Changed Type2", {"Column1.1", "Column1.2"}, "Changed Type2", JoinKind.LeftOuter),
#"Expanded Changed Type2" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type2", {"Column2", "Column3", "Column4"}, {"Changed Type2.Column2", "Changed Type2.Column3", "Changed Type2.Column4"}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Expanded Changed Type2", {{"Max", type text}}, "en-US"),{"Column1.1", "Max"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Transposed Table1" = Table.Transpose(#"Merged Columns"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true])
in
#"Promoted Headers"
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Of course, if you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What is that last screenshot representing? Looks more like a data view?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |