Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to matrix visualization with range of row values

Hello,

I have the following table in Excel. I want to create a matrix visualization in Power BI, with name as columns and week numbers as rows (week 1 to 52, individually). But the problem is that i do not know how to expand the start and end week numbers to show the complete range of week numbers by student name. For example, start week number 5 and end week number 8, but i need to have week numbers as 5,6,7,8 for that student name. The matrix visualization should then show those cells as highlighted. Any help is much appreciated!!

 

Start Week NumberEnd Week NumberStudent Name
23Bellegarde
33Frei Paulo
25Lizui
55Laufenburg
55Luntas
58Bellegarde
1010Cosamaloapan de Carpio
89Seedorf
69Gangarampur
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

tricky solution

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc09C8IwEAbgvxIyd/CDiq4WdOkgOIYMr/RaAmkSrt7irzeJHyAO7w0Pd/caoze60ducI3lPE3ggbRtTqeTE5NQF4mPlst3m9O4hrkr7EchI4SY8/bKEO5Yv7f+b1qtsdXRxwQwfkRDUQKoDJ/fqLXeHnCvREHmstnvbGSF/w5yEtbVP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Start Week Number" = _t, #"End Week Number" = _t, #"Student Name" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Week Number", Int64.Type}, {"End Week Number", Int64.Type}, {"Student Name", type text}}),
    Span = Table.CombineColumns(#"Changed Type", {"Start Week Number", "End Week Number"}, each let l={_{0}.._{1}} in Record.FromList(l, List.Transform(l, each "WK" & Number.ToText(_, "00"))), "Span"),
    #"Reordered Columns" = Table.ReorderColumns(Span,{"Student Name", "Span"}),
    #"Expanded Span" = Table.ExpandRecordColumn(#"Reordered Columns", "Span", List.Transform({1..52}, each "WK" & Number.ToText(_, "00")))
in
    #"Expanded Span"

CNENFRNL_0-1643486874085.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

tricky solution

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc09C8IwEAbgvxIyd/CDiq4WdOkgOIYMr/RaAmkSrt7irzeJHyAO7w0Pd/caoze60ducI3lPE3ggbRtTqeTE5NQF4mPlst3m9O4hrkr7EchI4SY8/bKEO5Yv7f+b1qtsdXRxwQwfkRDUQKoDJ/fqLXeHnCvREHmstnvbGSF/w5yEtbVP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Start Week Number" = _t, #"End Week Number" = _t, #"Student Name" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Week Number", Int64.Type}, {"End Week Number", Int64.Type}, {"Student Name", type text}}),
    Span = Table.CombineColumns(#"Changed Type", {"Start Week Number", "End Week Number"}, each let l={_{0}.._{1}} in Record.FromList(l, List.Transform(l, each "WK" & Number.ToText(_, "00"))), "Span"),
    #"Reordered Columns" = Table.ReorderColumns(Span,{"Student Name", "Span"}),
    #"Expanded Span" = Table.ExpandRecordColumn(#"Reordered Columns", "Span", List.Transform({1..52}, each "WK" & Number.ToText(_, "00")))
in
    #"Expanded Span"

CNENFRNL_0-1643486874085.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.