2 Replies Latest reply on Oct 9, 2016 2:09 AM by Rowel Zantua

# How to calculate mode from an aggregated data?

Hi everyone!

I've already found/read forums on how to calculate mode in tableau but with the data that I have I can't make it work.

Each 8 digit code may contain more than 1 value, as shown in the Detail view. I need to return the mode from the values of every 8 digit code.

For the example below, 1.36 should be returned as the mode for the code 39011019.

• ###### 1. Re: How to calculate mode from an aggregated data?

Hi Rowel,

You can use Level of Details (LOD) expressions to achieve this.

The formula is pretty long but the idea is basically like this:

1. Aggregate the Total Occurences for each combination of [8 Digit Code] & [Value]

2. Then, at the level of [8 Digit Code], get the highest (max) occurence value

3. When value in step_1 equals step_2, give me the [Value]

You can look at the result of each step in tab "step breakdown'.

If this is your first time using LOD, check out our learning resources - onlinehelp / tutorial / blogs to understand more on LOD.

It's a very powerful expressions that you should never miss

Cheers,

Seinchyi

• ###### 2. Re: How to calculate mode from an aggregated data?

Awesome! Thank you so much for your help!

Been using LOD but not this hard core