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

Be 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

Reply
Anonymous
Not applicable

Display columns of a matrix based on condition

Hi all,

 

I have a sales analysis report and I am looking for a simple way to conditionally display a column in a matrix. This because there are instances where column margin should not be displayed. The ideal would be a button or a yes/no switch. Is this anynow possible??

 

Thanks

C.

4 ACCEPTED SOLUTIONS
DOLEARY85
Super User
Super User

Hi,

 

A simple solution may be to create a bookmark and use a button to switch between the visual with/without the column.

 

 You can do this by:

 

  1. Create 2 visuals that are the the same, remove the margin column from one of them
  2. Open the bookmarks pane and add 2 bookmarks
  3. Open the selection pane, on one of the tables click the hide icon, now right-click your first bookmark in the bookmark pane and select update
  4. Unhide the first table and hide your second table, richt-click the second bookmark and select update
  5. Now you can add two buttons (one for on one for off) from the Insert tab (or any image you want) and update the action of the button in the format pane to select one of the bookmarks

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

lucadelicio
Super User
Super User

Hi,

this is the project with the solution to your problem.
https://we.tl/t-VSTDQvAzTN
You have to work on the code of the parameter that is related with the main dataset table.
You can choose description, Columns or Measures and order wich you want to show in base of what paramter is selected.

IF I HELP YOU TO RESOLVE YOUR PROBLEM PLEASE MARK IT AS A SOLUTION

Regards,



Luca D'Elicio

LinkedIn Profile

View solution in original post

To try in your model you have to create A PARAMETER FIELD. Than you can work on the code!

I hope you'll find the aswers to your question!

Enjoy



Luca D'Elicio

LinkedIn Profile

View solution in original post

Hi,

you can choose all the column for the selected parameter.
This is the code:
For every line you have Description, Measure or Column, OrderNumber, Referenced ParameterFiled

Parameter = {
    ("DescriptionA", NAMEOF([MeasureA]), 0, "A")
    ,("DescriptionA", NAMEOF([MeasureA]), 1, "A")

    ,("DescriptionB", NAMEOF([MeasureB]), 0, "B")
    ,("DescriptionB", NAMEOF([MeasureB]), 1, "B")
}

I hope i'll resolve your problem

Regards,




Luca D'Elicio

LinkedIn Profile

View solution in original post

10 REPLIES 10
lucadelicio
Super User
Super User

Hi,

this is the project with the solution to your problem.
https://we.tl/t-VSTDQvAzTN
You have to work on the code of the parameter that is related with the main dataset table.
You can choose description, Columns or Measures and order wich you want to show in base of what paramter is selected.

IF I HELP YOU TO RESOLVE YOUR PROBLEM PLEASE MARK IT AS A SOLUTION

Regards,



Luca D'Elicio

LinkedIn Profile
Anonymous
Not applicable

Thanks @lucadelicio, your solution looks very good. I will test it in my scenario but I believe will be working great.

 

Thanks!

C.

To try in your model you have to create A PARAMETER FIELD. Than you can work on the code!

I hope you'll find the aswers to your question!

Enjoy



Luca D'Elicio

LinkedIn Profile
Anonymous
Not applicable

Hi @lucadelicio , all implemented and working; thank you. One question is it possible with a single selection in the parameter's slicer to activate/deactiva two columns at once? I mean select "Margin Y/N" and have two columns activated/deactivated: Margin $ and Margin %. Is this anyhow possible?

 

Hi,

you can choose all the column for the selected parameter.
This is the code:
For every line you have Description, Measure or Column, OrderNumber, Referenced ParameterFiled

Parameter = {
    ("DescriptionA", NAMEOF([MeasureA]), 0, "A")
    ,("DescriptionA", NAMEOF([MeasureA]), 1, "A")

    ,("DescriptionB", NAMEOF([MeasureB]), 0, "B")
    ,("DescriptionB", NAMEOF([MeasureB]), 1, "B")
}

I hope i'll resolve your problem

Regards,




Luca D'Elicio

LinkedIn Profile
Anonymous
Not applicable

Hi @lucadelicio , this works perfectly, thanks.

 

One last point: what if I need to have my slicer to either display the two fields or.... nothing?! Is there a way? Can I have sort of a Button either diplaying the two fields or nothing?

Anonymous
Not applicable

Hi @lucadelicio maybe you can answer also to my last question above (either two fields displayed or nothing)?

DOLEARY85
Super User
Super User

Hi,

 

A simple solution may be to create a bookmark and use a button to switch between the visual with/without the column.

 

 You can do this by:

 

  1. Create 2 visuals that are the the same, remove the margin column from one of them
  2. Open the bookmarks pane and add 2 bookmarks
  3. Open the selection pane, on one of the tables click the hide icon, now right-click your first bookmark in the bookmark pane and select update
  4. Unhide the first table and hide your second table, richt-click the second bookmark and select update
  5. Now you can add two buttons (one for on one for off) from the Insert tab (or any image you want) and update the action of the button in the format pane to select one of the bookmarks

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Anonymous
Not applicable

Wow, this works too. Very simple.

 

Thanks!

C.

lucadelicio
Super User
Super User

Hi,

upload on https://wetransfer.com/ the pbix file and post an image in wich you explain the desire result.

I will help you!

Thank you



Luca D'Elicio

LinkedIn Profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.