Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

data visualization - TABLEAU - Calculating measure as a percentage of another measure

I want to calculate a measure as a percentage of another measure. For example, I have a field x_users and I want to calculate the percentage of this field in relation to the total_users. Then, I would like to visualize this percentage set against total_users. I believe I can accomplish this by utilizing dual axis.

Sample dataset

Date App x_users total_users
2020-01-01 A 5 10
2020-01-02 B 3 15
question from:https://stackoverflow.com/questions/65941571/tableau-calculating-measure-as-a-percentage-of-another-measure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For user percentage use this calculation

[x_users]/[total_users]

EDIT -- CORRECTION - For correct behavior, use an aggregate calculation as below for ratios such as this. That will give correct results even when you further aggregate results, say by removing App from the Row shelf.


    SUM([x_users]) / SUM([total_users])

enter image description here

For data-visual, a bar-within-bar plot is suggested with labels on user percentage,

  • dual axis (on x_user)
  • synchronise axis
  • change width of bar for secondary axis data (x_user)
  • unshow header for dual axis
  • add labels (on secondary axis data i.e. x_user) for above mentioned calculated field.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...