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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
PBI_hlpr1
Resolver I
Resolver I

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

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?

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 👍

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

https://www.linkedin.com/in/luca-d-elicio-74a481158/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.