Change Group by: date to Group by week/month/year in dashboard X axis

In an analysis, I can change the group by among different time type, but once it is made to dashboard, these options are no longer there. Is there a way to make that option still available in the dashboard or there is a different way for this? Thanks

Hi,

yes, that is possible.

  1. Create an single value parameter
  2. Create a Dropdown control from this parameter and manually write the list of values one can choose in this control
  3. Create calculated fields for each option with truncDate
  4. Create a calculated field
    ifelse(PARAMETER=‘year’,year_axis,
    ifelse(PARAMETER=month’, month_axis,…
  5. Use this calculated field as your x-axis
  6. You can move the control down to you visual

This way the user can change the x axis to different aggregationlevels.

1 Like

Thanks for the pointer. This looks like a good solution.

1 Like

Hi, I tried to follow your steps, but there must be something I don’t fully understand and it is not working at the moment. Can you take a look and see what I am missing:

  1. Created a single value parameter called XAxis (Data Type=String, Value = Single Value, Static default = Month)
  2. Did Add control with XAxis (Name=X-Axis,Style=Dropdown,Value=Specific values of Day/Week/Month, and Hide Select all option)
  3. Created these calculated fields with trucDate (date is my date column):
    Day: truncDate(‘DD’,date)
    Week: truncDate(‘WK’,date)
    Month: truncDate(‘MM’,date)
  4. Created a calculated field XScale as following:
    ifelse(${XAxis}=‘Day’,{Day},${XAxis}=‘Week’,{Week},${XAxis}=‘Month’,{Month},{Day})
  5. Use XScale as my x-axis for the visual
  6. I am not sure which “control” you are referring here. I assume it is XAxis that is already covered in Step 2. But it does not work. Nothing changed when I change the dropdown option. Could you clarify a little more?

Thanks for your help.

1 Like

Hi,

there is only one difference to my calculated field. I have NULL as the else-value

ifelse(${XAxis}=‘Day’,{Day}
,${XAxis}=‘Week’,{Week}
,${XAxis}=‘Month’,{Month},NULL)

I did everything else the same way. The values in the control are case sensitive, you can check this.

Can you create a table with XScale as the only column and then change the selection in the control? It is easier to see the changes in a table.

1 Like

Hi thomask,
There is something strange. I initially applied the procedure on my private data, I can see XScale was changing, but not the plot scale. So I was thinking let me use a public set of data so I can show you. However, the solution is working on the public set of data. So there must be something I did on my private data that prevented it from working. I will have to figure that out.
Clearly, your solution works. Thank you very much.

1 Like