简体   繁体   中英

How do you group data by percentile in Tableau, ignoring nulls

I am trying to bin my data based on Age in Tableau. There is a skewed distribution in my age column and I would like to group my data based on percentages. Here is the code that I have:

IF [Age]<={FIXED :PERCENTILE([Age],.2)} THEN "<20th" 
ELSEIF [Age]<={FIXED :PERCENTILE([Age],.4)} THEN ">20-40th"
ELSEIF [Age]<={FIXED :PERCENTILE([Age],.6)} THEN ">40-60th" 
ELSEIF [Age]<={FIXED :PERCENTILE([Age],.8)} THEN ">60-80th" 
ELSEIF [Age]<={FIXED :PERCENTILE([Age],1)} THEN ">80th" END

I was looking at the counts of my dataset and it looks like the count distribution is equal. This is how it looks like:

年龄分布计数

It looks like I am getting an equal distribution of ages because I have null elements. How can I remove all the null values when I am generating this graph and have an equal number of counts for the 5 bins?

If you right click on the bar for your "Null" age bin and hit "exclude" that should remove that bar from your graph by filtering out whatever data qualifies for that bin, assuming that is the intended result.

If that isn't the intended result, then you likely have null values for the Age column in your datasource. To confirm, right-click on the Null bar and hit "View Data" and click the second tab. Should should show a more detailed view of what the data from the source actually looks like.

将 Age_Bin 放在过滤器架上并取消选中“Null”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM