同一轴Tableau上的2个尺寸

问题描述

我正在尝试将2维绘制成条形图。因此,我有数据可以查看客户购买的产品,共有5种不同类型的产品,而我从2家不同的商店购买了这些产品。因此数据看起来就像存储在2个不同的excel文件中。

Store 1
customer_ID product
1           apple
1           orange
2           apple

Store 2
customer_ID product
1           apple  
1           orange 
2           pear

我希望能够在x轴上具有乘积,然后在y轴上进行计数。两家不同颜色的商店。是否可以在Tableau中执行此操作,还是我需要将数据重新排列到1个像这样的表中?

customer_ID product store
1           apple   1
2           orange  2

解决方法

您确实可以在Tableau中执行此操作。我用示例数据创建了两个名为Store1和store2的Excel文件。

您应该这样做

在Tableau中导入第一个文件。之后,双击“新建联合”按钮

enter image description here

在“通配符”对话框中,键入Store * .xlsx

enter image description here

您的联盟是自动创建的,具有文件名 enter image description here

您现在可以轻松地根据需要创建视图。如有任何其他问题,请告诉我。

enter image description here