Tableau Challenges #1 Link Tableau Challenges Solutions #1 Link
Join the Vizuators team!
Website: https://vizuators.by/ Telegram: https://t.me/viz_techreview Tableau Public: https://public.tableau.com/app/profile/vizuators.challenges Youtube: https://www.youtube.com/c/Vizuators Instagram: https://instagram.com/vizuators Facebook: https://www.facebook.com/vizuators.by/ Twitter: https://twitter.com/vizuators LinkedIn: https://www.linkedin.com/company/vizuators
Abstract author: Ekaterina Kalabush
Fix the X-axis so that its end never falls below 20% regardless of the size of the bar charts, but increases when the charts exceed 20%.
Step 1: Put Sales in Column, Department and Category in Rows.
Step 2: Right-click on Sales in Columns and select Quick Table Calculations → Percentage of Total to calculate what percentage of all sales each category takes.
Step 3: Create a Calculated field "Reference line”:
IF SUM([Sales]) / TOTAL(SUM([Sales])) > 0.2 THEN SUM([Sales]) / TOTAL(SUM([Sales])) ELSE 0.2 END
In simple words, what the "Reference line" is about: if the percentage of sales is greater than 0.2 (i.e. 20%), then leave the percentage unchanged. Otherwise, return the number 0.2 (20%).
Step 4: Drag the pill “Reference line” to Detail.
Step 5: Go to the Analytics section, drag the Reference line to the area with the graph, select the Table area.
Step 6: Select the settings for the Reference Line, as in the screenshot.
Done! Now the values on the axis will not fall below 20%. But if the values of the bars are more than 20%, then the axis will be movable.