Skip to Content
实用 Tableau
book

实用 Tableau

by Ryan Sleeper
May 2025
Intermediate to advanced
624 pages
7h 35m
Chinese
O'Reilly Media, Inc.
Content preview from 实用 Tableau

第 37 章 如何制作瀑布图 如何制作瀑布图

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

本章将分享如何在 Tableau 中制作瀑布图--一种有助于了解维度成员的正负值对累计总数的贡献的可视化图表。 瀑布图与简单的运行总计计算不同之处在于,瀑布图说明了具有正值的每个维度成员如何增加运行总计,而具有负值的每个维度成员如何减少运行总计。在本教程中,我们将在 Tableau 中绘制以下瀑布图,直观显示样本 - 超级市场数据集中的每个子类别对总利润的贡献:

prta 3701

要在 Tableau 中启动瀑布图,请创建一个垂直条形图,按 维度 "子类别 "显示度量值 "利润":

prta 3702

接下来,为利润指标添加表格计算,以便在表格(横向)上计算 "运行总计"。 有关表格计算的复习,请参阅第 13 章。添加快速表格计算后,视图如下所示:

prta 3703

正如导言中提到的,虽然此时我们可以看到不同子类别的累积总计,但要确定每个维度成员的正负贡献并不容易。为了方便起见,我们将通过几个额外的步骤,把显示总运行情况的条形图转换成瀑布图。

首先,将标记类型从 "自动"(当前为 "条形图")改为 "甘特图条形图"标记类型:

prta 3704

要让该视图看起来像本章的第一张图片,我们需要让每个条形图的顶部或底部与 Y 轴上的相同点对齐。为此,我们必须调整甘特图条的大小,以便扩展它们。虽然你的第一反应可能是根据利润测量值,甚至是包含运行总计计算表的视图上的利润测量值来确定甘特图柱形图的大小,但要达到预期效果,这一步还是有诀窍的。为了使每个维度成员的甘特图条正确排列,首先必须创建一个新的计算字段,将瀑布图中的度量乘以负一。 本例使用的是利润指标,因此我将创建一个新的计算字段,等于 -[利润]:

prta 3705

创建此计算字段后,您就可以将其拖到尺寸标记卡上,创建瀑布效果:

prta 3706
备注

第 13 章中,我提到过双击视图上的度量值可以获得一种 "X 光透视",显示度量值的底层语法。 在分析过程中,也可以使用这一技巧来更改度量值。将利润度量值转换为负值的另一种方法是将 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python深度学习从原理到应用

Python深度学习从原理到应用

Posts & Telecom Press, Valentino Zocca
数据科学实战手册(R+Python)(第2版)

数据科学实战手册(R+Python)(第2版)

Posts & Telecom Press, Prabhanjan Narayanachar Tattar, Tony Ojeda, Sean Patrick Murphy, Sean P Murphy, Benjamin Bengfort, Bengfort Benjamin, ABHIJIT DASGUPTA
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普
程序设计导论:Python语言实践

程序设计导论:Python语言实践

罗伯特 塞奇威克, 凯文 韦恩, 罗伯特 唐德罗

Publisher Resources

ISBN: 9798341657137