7 Replies Latest reply on Nov 26, 2018 1:23 AM by Dustin Guiyab

# Percent of total from value in Dimension

Hi there,

I have a large table of data that has the following structure -

Date
User Attribute
Count
1/1/16Web Session50
1/1/16Purchase30
1/1/16Active100
1/2/16Web Session50
1/2/16Purchase40
1/2/16Active90

I'm trying to create a calculation that displays % of total Active based on whether they had a web session or purchase.

For example ideally the data would be structured like this in Tableau

Date
1/16/161/2/16
Web Session50% (50/100)55% (50/90)
Purchase30% (30/100)44% (40/90)

I want to see what % of users are actually engaging on our website. I am able to do a full percent of total however it calculates it from all parts of the 'User Attribute' column whereas I want to calculate the percent of total from a value within that dimension.

I've searched through the forums and haven't found a request that leverages data within a dimension. Any ideas?

Message was edited by: Minh Nguyen

• ###### 1. Re: Percent of total from value in Dimension

I have a table that combines a running count of total web sessions, total purchases and total active users per day. I want to create a dashboard or report that tracks what % of active users have a web session/purchase per day.

• ###### 2. Re: Percent of total from value in Dimension

If it is percent of total active users by day, shouldn't web session be 50/90 and purchase be 40/90 for 1/2/2016 because there are 90 active users on that day?

If my assumption is right then you can create a LOD expression to capture the count of active users at the level of day and then divide sum(count) by this new calc:

Active Users: {fixed [Date] : sum( IF [User Attribute] = 'Active' then [Count] end) }

Percentage: sum([Count]) / sum([Active Users])

User attribute on rows, date on columns , user attribute in filter and exclude 'active' and percentage on text:

• ###### 3. Re: Percent of total from value in Dimension

Hi Pooja,

This seems to be the closest answer! I'm running into an error when I try to create the Active Users expression - Cannot mix aggregate and non-aggregate comparisons or results in 'IF' expression.

Thanks,

Minh

• ###### 4. Re: Percent of total from value in Dimension

Minh,

Are you using the expression I suggested? Is the count field already aggregated? Can you share some screenshots and/or your data? That would help me help you faster and more effectively!

Thanks,

Pooja

• ###### 5. Re: Percent of total from value in Dimension

Followed it exactly and it worked - THANK YOU!

• ###### 6. Re: Percent of total from value in Dimension

thanks!!!!!

• ###### 7. Re: Percent of total from value in Dimension

Hi Minh,

Could you share the Active Users Formula?  I am getting the "cannot mix aggregates and non-aggregates error comparisons in IF expresssions?

Thank you!

Dustin