具有混合数据类型(文本和数字)的动态细分维度

Dynamic Breakdown Dimension with Mixed Data Type (Text and Number)

是否可以使用混合数据类型创建动态细分维度?

This is the data source sample

This is the Report I Tried

基本上我希望具有仅查看权限的用户使用 C1-Cn 细分维度动态更改 Q1-Qn 图表的细分维度

我尝试了以下步骤:

CASE breakdown by parameter
  WHEN "C1" THEN C1 
  WHEN "C2" THEN C2
  WHEN "C3" THEN C3
  WHEN "C4" THEN C4
  WHEN "C5" THEN C5
END

但是上面写着Invalid formula - THEN/ELSE arguments have incompatible types: TEXT/ NUMBER. All THEN/ELSE arguments must return the same type.。有解决方法吗?如果细分维度仅为文本或数字,则工作正常。

我也用控件过滤数据,所以想用控件过滤C1-Cn列,设置细分维度为C1-Cn列

如错误消息中所述(强调我的)

Invalid formula - THEN/ELSE arguments have incompatible types: TEXT/ NUMBER. All THEN/ELSE arguments must return the same type.

因此(因为除了一个参数 return 之外的所有参数都是 TEXT 类型),一种方法是 CAST the only NUMBER field C2, AS TEXT, so that all values in the calculated field 是文本值:

CASE breakdown by parameter
  WHEN "C1" THEN C1
  WHEN "C2" THEN CAST(C2 AS TEXT)
  WHEN "C3" THEN C3
  WHEN "C4" THEN C4
  WHEN "C5" THEN C5
END

Editable Google Data Studio Report (Embedded Google Sheets 数据源)和一张 GIF 来详细说明: