Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi !
I'm trying to add a Mode measure into my prices matrix grid similiar to what I have below in excel. My matrix is set up the same way in pbi. It would be great if I could also find a way to count the number of prices that match the Mode. Thanks in advance!
| Product | Amazon | Walmart | Bestbuy | Home Depot | Lowes | Target | Mode |
| 1 | 200 | 200 | 150 | 125 | 300 | 275 | 200 |
| 2 | 50 | 75 | 75 | 75 | 85 | 60 | 75 |
| 3 | 300 | 300 | 600 | 450 | 400 | 500 | 300 |
| 4 | 25 | 50 | 60 | 60 | 60 | 45 | 60 |
| 5 | 100 | 100 | 75 | 75 | 65 | 85 | 100 |
Solved! Go to Solution.
Hi , @jboschee
According to your description, you want to get the [Mode] column in Power BI.Right?
For your need , i recommend you to realize it in Power Query Editor.
You can put this M code in the "Advanced Editor" in Power Query Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VY7BDcAwCAN34Z0HECDdBbH/Gg3QRsrnZGGDcQeCAYx4SFpk3Zw9XwoxHHjrMpdeeBKGlZlnq2lFqTUprdhJycv6n7Qb0o1pU3+Fd7F9xREv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product " = _t, #" Amazon " = _t, #" Walmart " = _t, #"Bestbuy " = _t, #" Home Depot " = _t, #"Lowes " = _t, #"Target " = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product ", Int64.Type}, {" Amazon ", Int64.Type}, {" Walmart ", Int64.Type}, {"Bestbuy ", Int64.Type}, {" Home Depot ", Int64.Type}, {"Lowes ", Int64.Type}, {"Target ", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (x)=> Table.Sort(Table.AddColumn(Table.FromColumns({List.Skip(Record.ToList(x))}),"count",(y)=> Table.RowCount(Table.SelectRows(Table.FromColumns({List.Skip(Record.ToList(x))}),(z)=>z[Column1]=y[Column1])) ,type number ),{"count",1})[Column1]{0} )
in
#"Added Custom"
Then we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @jboschee
According to your description, you want to get the [Mode] column in Power BI.Right?
For your need , i recommend you to realize it in Power Query Editor.
You can put this M code in the "Advanced Editor" in Power Query Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VY7BDcAwCAN34Z0HECDdBbH/Gg3QRsrnZGGDcQeCAYx4SFpk3Zw9XwoxHHjrMpdeeBKGlZlnq2lFqTUprdhJycv6n7Qb0o1pU3+Fd7F9xREv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product " = _t, #" Amazon " = _t, #" Walmart " = _t, #"Bestbuy " = _t, #" Home Depot " = _t, #"Lowes " = _t, #"Target " = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product ", Int64.Type}, {" Amazon ", Int64.Type}, {" Walmart ", Int64.Type}, {"Bestbuy ", Int64.Type}, {" Home Depot ", Int64.Type}, {"Lowes ", Int64.Type}, {"Target ", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (x)=> Table.Sort(Table.AddColumn(Table.FromColumns({List.Skip(Record.ToList(x))}),"count",(y)=> Table.RowCount(Table.SelectRows(Table.FromColumns({List.Skip(Record.ToList(x))}),(z)=>z[Column1]=y[Column1])) ,type number ),{"count",1})[Column1]{0} )
in
#"Added Custom"
Then we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Arul ,
Here's the formula in excel =MODE(C2:H2). Part of my question was how to get the mode in PBI and then do a count of the mode occurances as well.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!