How to customise the value labels showing in a Graph

Knowledge Drop

Last tested: May 25, 2020
 

The Problem

Sometimes users want to be able to customize values being shown on a line graph. So if the date range is day over days, we want to set the values being shown to only show a value every 7 days for instance. For example, the below graph is very noisy:Screenshot 2020-05-25 at 16.30.23.png

A Solution

 

UI FILTERS

So, in case we want to show the value every 7 days from a specific Day, we could filter on the day of the Week (Monday, Tuesday...) we want to show the values. Note that we will need to under "Edit" leave off "Plot Null Values" OR remove the filled out dates from the Date dimension so the nulls will be removed. This suggestion will look like this:Screenshot 2020-05-19 at 12.27.04.png

Table Calculation

Now, in case we would like to display values every 7 days from today. We could use the following table calculation by applying the mod() function

 

if(mod(diff_days(${order_items.created_date},now()), 7) = 0 , yes, no)

To explain here, we get the date difference between the date field and now(). Then the mod function will divide the date difference by 7 and then let us know what the remainder is. And we want to only show where the remainder is 0 because that means its a multiple of 7! After this, we need to "Hide No's from the Visualisation". It will look like this

Screenshot 2020-05-19 at 12.36.05.png

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:15 PM
Updated by: