Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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.

  • 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 👍

  • 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,

  • 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

  • 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,


10 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Icon for Resident Rockstar rankResident Rockstar

    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's avatar
      Anonymous
      Not applicable

      Wow, this works too. Very simple.

       

      Thanks!

      C.

  • lucadelicio's avatar
    lucadelicio
    Icon for Impactful Individual rankImpactful Individual

    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,

    • Anonymous's avatar
      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.

      • lucadelicio's avatar
        lucadelicio
        Icon for Impactful Individual rankImpactful Individual

        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