Jump to content

how to write case statement in x-axis for binbydatetime


krishnan krishnan

Recommended Posts

Writing case statement in x-axis for binned columns will end up concatenating the values like2015.Q1.Mar so we have following other ways to achieve it.

One value to achieve this is through setting values in document property:

You can create a dropdown list document property with Fixed values or Expressions containing values likeBinByDateTime([date],"Year.Quarter.Month",2) and FiscalBinByDateTime([date],"Year.Quarter.Month",2). Then use this document property in this x-axis of visualization.

So whenever you change the document property x-axis will also change according to the expression value present in dropdown list.

Other way to achieve this is through setting values in document property using iron python script:

Create a string document property say "Expr". then you can create a dropdown list document property with Fixed values. Insert a script to act on dropdown property change that will set "Expr" property value as BinByDateTime([date],"Year.Quarter.Month",2) or FiscalBinByDateTime([date],"Year.Quarter.Month",2)based on dropdown property selection. Use this "Expr" property in x-axis of visualization.

Below is the Iron Python scripting API for reference.

https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-a...

Link to comment
Share on other sites

  • 2 years later...
I was trying to achieve the same solution via the same approach but landed in a bit of issue representing data the way user anticipated. When we use BinByDateTime([date],"Year.Quarter",2) in a calculated column, it takes away its grouping on the visualization. For Example, if i had Year.Quarter as a selection it displays bar chart as 2018.Q1, 2018.Q2 and so on instead of grouping all quarters of 2018 under one branch. Does anyone have a solution on how to achieve same formatting as we do binning at the Category Axis level when we display X-Axis using "Set from Property" functionality.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...