Switchable Dimensions

Comments

46 comments

  • Avatar
    Alon Ahronberg

    Here is another example on how define switchable values (example is also included in the attached dashboard):

    Script Code: 

    prism.registerSwitchDimension({
    
    	widget: widget,
    	dimensions: [
    		{
    			"index":0,
    			"panel": "values",
    			"dim":"[commerce.revenue]",
    			"title":"revenue",
    			"widgetTitle":"Year By Revenue" // optional
    		},
    		{
    			"index":0,
    			"panel": "values",
    			"dim":"[commerce.cost]",
    			"title":"cost",
    			"widgetTitle": "Year By Cost" // optional
    		}
    	]
    	
            });
    
  • Avatar
    Michal

    Is it possible to apply the switchable dimension to a calculated measure ?

    I wanted to do so using the value panel but I am not sure what to put in the dim

     

  • Avatar
    Alon Ahronberg

    Hi Michal,

    The script supports only the sum() function, so in the "dim"  you just need to place the measured fields that will be summed.

     

  • Avatar
    Michal

    Hi,

    I'm trying to create changeable "break by" panel  on bar chart with calculated measure and it doesn't work.

    I have done it on line chart and it works amazing there.

    What am I missing here?

    * here is my code:

    prism.registerSwitchDimension({

    widget: widget,
    dimensions: [
    {
    //-------------- Dim1
    "index":0,
    "panel": "break by",
    "dim":"[X1.Y1]",
    "title":"Y1",
    "widgetTitle":"Dim = Y1"
    },
    {
    //-------------- Dim2
    "index":0,
    "panel": "break by",
    "dim":"[X1.Y2]",
    "title":"Y2",
    "widgetTitle":"Dim = Y2"
    }
    ]
    });




    Barchart.png
  • Avatar
    Alon Ahronberg

    Hi Michal,

    Its working on bar and column chart as well, if you changing between widget types you might need to re-enter the script, save it again, refresh the widget and click apply.

     

     

  • Avatar
    Michal

    Hi,

    Its still doesn't work.

    When I shift at that widget the field from "break by" to "categories" and change it in the script as well it works wonderfully.The "break by"  changeable dim option at column chart (and bar chart as well) doesn't work.

    Can you think of any solution here?

    Thanks!!!

  • Avatar
    Alon Ahronberg

    Hi Michal,

    Your script  looks fine.

    Attached is an example for switchable dimension on a break by field (base on the the eCommerce sample data cube).

    I suggest to try and re create the widget  from scratch, and applying the script.

     

    Did it worked?

     

     

  • Avatar
    Michal

    Hi,

    There is no attachment...    :)

     

    Thanks,

     

  • Avatar
    Alon Ahronberg

    Here it is :)




    SwitchDimensionbrakeby.dash
  • Avatar
    Michal

    Thanks Alon,

    Well, I found the problem. The only difference from the example you attached and my the barchart is "categories" field filled (attached screenshot)

    When I deleted the categories field from your example the changing dimension didn't work anymore...

    I did the opposite on my chart (add categories field) and it worked.

    I have no idea why having no "categories" makes the "break by" in the script not working, but this is the situation.

    On my chart I don't need "categories" so I'm still with no solution for "break by" changeable dimension...

     

    Thanks,




    Barchart.png
  • Avatar
    Alon Ahronberg

    Hi Michal,

     

    You are correct, without categories, menu doesn't exist when right clicking on the widget.

    I suggest one of the below options:

    1. Use the categories instead of break by

    2. Use a fictive category by creating a custom field in the Elasticube. 

     

    Hope that helps

    Alon

  • Avatar
    Joseph Peters

    I can't seem to get this to work at all.  I've created a very simple column chart and am trying this with two fields (CallQueue and Status)  from the Incident table.  I've extracted the folder correctly into my plugins folder (C:\Program Files\Sisense\PrismWeb\plugins\SwitchDimension) and am using the code below but the option doesn't appear in the menu at all when I right click on a column.

    prism.registerSwitchDimension({
    widget: widget,
    dimensions: [
    {
    "index":0,
    "panel": "categories",
    "dim":"[Incident.CallQueue]",
    "title":"callqueue",
    "widgetTitle":"Incidents by CallQueue"
    },
    {
    "index":0,
    "panel": "categories",
    "dim":"[Incident.Status]",
    "title":"status",
    "widgetTitle": "Incidents by Status"
    }
    });

  • Avatar
    Alon Ahronberg

    Hi Joseph,

    Have you created both columns in the chart ?

    Try to create just one and the apply the filter.

     

  • Avatar
    Nicholas Ranum

    Did 5.7.5 break this plugin? It's not working for me after I performed the update.

  • Avatar
    Alon Ahronberg

    Hi Nicholas,

    Thanks for bringing it to our attention. I've update the plugin zipped folder, please replace the old folder with the updated one.

     

    Thanks

  • Avatar
    Nicholas Ranum

    I updated the plugin to allow for switching between Date fields also. Use the format of the following code snippet to your widget. 

    You'll be adding two fields, level and datatype, and will format dim slightly different.

    1. Level indicates whether you want Years, Quarters, Months or Days
    2. Datatype: tells the widget that the dimension is datetime, this way it will format it appropriately otherwise you end up with a longer string
    3. Remember to add (Calendar) to the date field's name when putting it under dim

    {
    "index":0,
    "panel": "columns",
    "dim":"[SalesData.Date (Calendar)]",
    "level":"quarters",
    "datatype":"datetime",
    "title":"Quarters",
    "widgetTitle": "Quarters"
    },
    {
    "index":0,
    "panel": "columns",
    "dim":"[SalesData.Date (Calendar)]",
    "level":"months",
    "datatype":"datetime",
    "title":"Months",
    "widgetTitle": "Months"
    }

    This is super helpful when applied with the appropriate filters.




    SwitchDimension.zip
  • Avatar
    Nicholas Ranum

    I updated the plugin again to give more options for aggregation other than sum. This includes average, max, min, count, etc.

    Unzip the plugin I attached and add it into your plugin folder. Include the field called "agg" on the widget's custom javascript, it allows you to choose the form of aggregation you want.

    {
    "index":0,
    "panel": "values",
    "dim":"[SalesData.number1]",
    "agg":"avg",
    "title":"Average",

    },
    {
    "index":0,
    "panel": "values",
    "dim":"[SalesData.number2]",
    "agg":"max",
    "title":"Max #",

    },
    {
    "index":0,
    "panel": "values",
    "dim":"[SalesData.number3]",
    "agg":"count",
    "title":"Count",

    }

    This does not apply to custom measures, only simple aggregations.




    SwitchDimension.zip
  • Avatar
    Alon Ahronberg

    Thanks Nicholas,

    This is a great addition, you probably edited the switchDimension.js file to enable drilling on a few time levels and to enabled the aggregation.

    Could you please share this file as well ?

     

    Many Thanks !

  • Avatar
    Nicholas Ranum

    My post on May 15 has the most updated version of the plugin I was working with which includes the updated switchDimension.js file

  • Avatar
    Konstantinos

    Hi there, I am trying to use this really helpful plugin, but when i am trying to switch in "values" level i fail. Below is the script i am using for it, but it works when i use it on "categories" level. I have tried both "agg" on and "agg" off. (I have copied Nicholas plugin). Can you please help me?

    prism.registerSwitchDimension({

    widget: widget,
    dimensions: [
    {
    //first field configuration
    "index":0,
    "panel": "values",
    "dim":"[TSUnilever.SalesVolume_000_KGS]",
    //"agg":"sum",
    "title":"Sales Volume % share",// optional,
    "widgetTitle":"Top Manufacturers MAT Volume share" // optional
    }
    // **********duplicate this part for any additional field
    ,{
    //second field configuration
    "index":0,
    "panel": "values",
    "dim":"[TSUnilever.SalesValue_000TOM]",
    //"agg":"sum",
    "title":"Sales Value % share", // optional,
    "widgetTitle": "Top Manufacturers MAT Value share" // optional
    }
    //***********
    ]

    });

  • Avatar
    Sam Chick

    Is there a way to do this if there are multiple bars per category? I've tried changing the index parameters in the script but it doesn't seem to work.

  • Avatar
    Michael Becker

    I've tried it in interesting case when I use this plugin to switch between two dimensions and each of them has a hierarchy defined(each hierarchy is selected as to always appear for its' dimension). It all works when you right click on Bar and drill there, but breadcrumbs and drill up button never appear although space within widget, is allocated for them. Any suggestions how to overcome this?

  • Avatar
    Nicholas Ranum

    I've run across the same problem as Michal. This plugin has proved invaluable for my end users and they have been asking me if there is a fix. Any word on this?

  • Avatar
    Alon Ahronberg

    Hi Michal, Nicholas

     

    This plugin was written before the drilling hierarchies feature.

    I requested it to be adjusted - hope to release an updated version in the coming weeks.

     

    Alon

  • Avatar
    Oleg Fil

    Hi Michal,

    Please open a ticket for this issue with more detailed steps to reproduce. Also put a note there which version of Sisense app you are using.

    Thanks,

    Oleg

  • Avatar
    Nicholas Ranum

    I've created a fix that circumvents the drill down issue caused by the plugin. The attached javascript should be added to the table with the Switchable Dimensions code. The code recreates the X button that resets the drill down to where it was originally when the button is not there.

    There might be more graceful ways to do this but this one works perfectly for me. 




    SD_DrilldownFix.txt
  • Avatar
    Alon Ahronberg

    Thanks for sharing it with us Nicholas !

  • Avatar
    Susvith Paduri

    Can't I create transpose Pivot and Switchable dimensions on a single pivot table? 

  • Avatar
    Denis Pesa

    Hi,

    I have noticed that when I switch to a dimension and then add a dashboard filter for the same dimension, the widget breaks. If I filter by other dimensions, it works fine. Any thoughts?

    Thanks!

  • Avatar
    Adi Hecht

    This works fine for column charts and pivots, but doesn't seem to work for a column chart with 2 categories.

    I want the viewers to be able to change the 2nd category.

    The problem is, when there are 2 categories in the chart, then the menu does not appear at all.

    Can anyone help with this?

Please sign in to leave a comment.