Show Mileage as percentage in visual

Hi,
I have a dataset that looks like this:

ID Mileage
101 200
102 300
103 400
104 NULL
105 50
106 NULL

What I’m trying to achive is to visualize the Mileage per ID as percentage of the total Mileage (sum of Mileage). I’d like to visualize it in a horizontal bar chart.

But I don’t really have a clue how to get this working.

Thank’s for the quick response. But there is no function totalSum()…

you are correct !
Sorry and apology i wrongly advised.. let me correct it by deleting the advise .. will relook into it

could you try

First, create a calculated field that calculates the percentage of total mileage for each ID.

You may use a formula like:

({Mileage} / sum({Mileage})) * 100 

Next, follow these steps to create your horizontal bar chart:

  1. On the analysis page, choose Visualize on the toolbar at left refer bar chart doc here

  2. Choose Add, then Add visual

  3. Select the Horizontal bar chart icon from the Visual types pane

  4. Drag the ID field to the Y-axis field well

  5. Drag your newly created percentage calculation to the Value field well

This will display each ID as a row with a horizontal bar representing its percentage of the total mileage.

The chart will automatically handle NULL values in your dataset by excluding them from the calculation.

If you want to show IDs with NULL values as zero bars in your chart, you could create a calculated field that replaces NULL values with 0 before calculating the percentage.

Hope this gives some idea.

Cheers,
Deep

Hi @Markus,
It’s been awhile since we last heard from you on this thread, did you have any additional questions or were you able to find a work around?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you