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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
hallmarke14
Frequent Visitor

Power BI - Dynamic View Options - Matrix

I have been asked to make a matrix dynamic in a sense that you could check and uncheck a box to only have certain columns show or hide.  Attached is a mockup:

hallmarke14_0-1728504928210.png

 

Any ideas or suggestions will be greatly appreciated!

7 REPLIES 7
vicky_
Super User
Super User

Assuming your columns are DAX measures, you can use field parameters for that: https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters

Hi, Vicky.  Just wanted to thank you for the tip and provide an update.  We use Analysis Services, so we have a Live Connection for this particular report.  I understand that there is a limitation on that, so I found an alternative solution, which was to create a table in SSAS of the names of the columns and create the following measure:

hallmarke14_0-1728674461075.png

 

SelectedMeasureShow =
SWITCH(
    SELECTEDVALUE(ColumnSelector[Column]),
    "Units TY", FORMAT([UnitsTYShow], "#,##0"),
    "Units SDLY", FORMAT([UnitsSDLYShow], "#,##0"),
    "% CHG Units", FORMAT([%CHGUnitsShow], "0.0%"),
    "Sales TY", FORMAT([SalesTYShow], "$#,##0"),
    "Sales SDLY", FORMAT([SalesSDLYShow], "$#,##0"),
    "% CHG Sales", FORMAT([%CHGSalesShow], "0.0%")
)
 
I created a slicer that uses the column table and it works very nicely, but since the matrix uses one measure, I am not able to implement conditional formating for the % measures (red for negative numbers, and green for postive) without it affecting all of the results.  I would like to be able to have the matrix to accept multiple selections, but it doesn't like it when I select more than one measure.

If anyone has any ideas or a tricks to allowing conditional formatting when there is only one measure or a way to be able to select multiple selections to expand the matrix beyond the initial 6 columns, that would be greatly appreciated!
Anonymous
Not applicable

Hi @hallmarke14 ,

I create a table as you mentioned.

vyilongmsft_0-1728874556756.png

Then I think you can create some measures and here are the DAX codes.

UnitsTYShow = SUM(SalesData[UnitsTY])
UnitsSDLYShow = SUM(SalesData[UnitsSDLY])
%CHGUnitsShow = DIVIDE([UnitsTYShow] - [UnitsSDLYShow], [UnitsSDLYShow], 0)
SalesTYShow = SUM(SalesData[SalesTY])
SalesSDLYShow = SUM(SalesData[SalesSDLY])
%CHGSalesShow = DIVIDE([SalesTYShow] - [SalesSDLYShow], [SalesSDLYShow], 0)

vyilongmsft_3-1728874759054.png

You can also create colors on them.

%CHGUnitsColor = IF([%CHGUnitsShow] < 0, "Red", "Green")
%CHGSalesColor = IF([%CHGSalesShow] < 0, "Red", "Green")

vyilongmsft_2-1728874704775.png

Then I create a new table and also create a measure.

ColumnSelector = 
DATATABLE(
    "Column", STRING,
    {
        {"Units TY"},
        {"Units SDLY"},
        {"% CHG Units"},
        {"Sales TY"},
        {"Sales SDLY"},
        {"% CHG Sales"}
    }
)

vyilongmsft_4-1728874872367.png

SelectedMeasureShow = 
SWITCH(
    SELECTEDVALUE(ColumnSelector[Column]),
    "Units TY", FORMAT([UnitsTYShow], "#,##0"),
    "Units SDLY", FORMAT([UnitsSDLYShow], "#,##0"),
    "% CHG Units", FORMAT([%CHGUnitsShow], "0.0%"),
    "Sales TY", FORMAT([SalesTYShow], "$#,##0"),
    "Sales SDLY", FORMAT([SalesSDLYShow], "$#,##0"),
    "% CHG Sales", FORMAT([%CHGUnitsShow], "0.0%")
)

vyilongmsft_5-1728874914042.png

vyilongmsft_6-1728874949201.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, Yilong!

 

I tried adding the color measures, but they don't actually change the color of the values.  All it did was show the string values "red" or "green" based on the IF condition.  I was hopeful when I saw your idea.  I appreciate your effort!

Anonymous
Not applicable

Hi @hallmarke14 ,

If you are only coloring other columns, in Powerbi you can just select Conditional formatting to change it.

vyilongmsft_0-1728954625958.png

But if you want to colorize based on your choices in Slicer, my suggestion would be to aggregate Measure in the same format for modification.

vyilongmsft_1-1728954895027.png

vyilongmsft_2-1728954945137.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

I have only one measure in Values and that populates the matrix.  We have several Channels, which is what our columns are that we want for comparison.  If I choose conditional formatting for that measure, the changes apply to all values, not just the % Chg columns.  

 

hallmarke14_0-1728956523707.png

hallmarke14_1-1728956996115.png

If I apply conditional formatting, these values will be colorized, but when I change the selection to Units, those are colorized, as well, and we do not want that.

I will give that a try!  Thank you, Vicky!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.