6 Replies Latest reply on Mar 8, 2016 4:17 PM by Eli Blankers

# Percentage of Total when Measures are Calculations

Greetings,

I am trying to figure out how to get a % of total when all of the metrics are created from filters & calculations.

My Workbook connects to Google Analytics which for client privacy I am not allowed to share.

My method to filter Pageviews by URL probably isn't the most efficient so i'm open to suggestions on that as well.

Dimension:

Page is Service or Parts:

Calculation:

REGEXP_MATCH([Page],'(/(s|S)ervice-(p|P)arts/)' )

Measure:

True Count Service or Parts:

Calculation:

IF [Page is Service or Parts] = TRUE THEN [Pageviews] ELSE NULL END

I have 3 additional calculations similar to the above to filter other URL strings.

This gives me the correct Pageviews value, however I have been unsuccessful figuring out how to get a % of total [Pageviews] for each Measure. I have tried table calculations, but so far no luck.

For an example what I am trying to accomplish is something like this:

What I have is:

Hope this makes sense. Thanks for any insight!

• ###### 1. Re: Percentage of Total when Measures are Calculations

Hi Christina,

Unless I'm missing something, I believe this can be solved with a Level of Detail (LOD) calculation.  Something to the effect of:

SUM(PageViews)/ {FIXED : SUM(PageViews)}

Let me know if this works.

Cheers,

Eli

• ###### 2. Re: Percentage of Total when Measures are Calculations

Hi Eli,

I tried that, but got the below error..

• ###### 3. Re: Percentage of Total when Measures are Calculations

The error calculation error will go away if you wrap the LOD calculation with an ATTR() function.

SUM( [Pageviews] ) / ATTR( {FIXED : SUM( [Pageviews] )  } )

• ###### 4. Re: Percentage of Total when Measures are Calculations

Hi Christina!

Your current data structure is wide, meaning all the measures are in separate columns instead of tall where the measure names are in one single column with their associated measure values. I think LOD wouldn't work for this example. If you can, it would be best to reshape the dataset before you bring it into Tableau with the structure I described above. Hope that helps.

Pooja.

1 of 1 people found this helpful
• ###### 5. Re: Percentage of Total when Measures are Calculations

Thank you! While all answers were helpful (and educational) I marked Pooja's correct because my data is wide and could not be combined the way I had it.