Updated post with more details as requested.
更新了帖子,并根据要求提供了更多细节。
I have a data source containing list of people with name, age, hair color, size, ... I want to work with the age data.
我有一个数据源,其中包含姓名、年龄、头发颜色、体型、…我想要使用年龄数据。
Source Data
源数据
Age |
50 |
33 |
37 |
33 |
13 |
15 |
36 |
10 |
5 |
15 |
16 |
46 |
19 |
17 |
36 |
44 |
32 |
38 |
3 |
I created calculated fields to fill ages categories : "0-10 y/o", "11-20 y/o", ... by step of 10 years. Everything OK at this stage using CASE ... WHEN.
我创建了计算字段来填充年龄类别:“0-10岁/岁”、“11-20岁/岁”、……一步一步地走10年。在这个阶段一切正常使用案例..。什么时候。
Calculated Field
计算字段
CASE
WHEN Age>0 AND Age<=10 THEN "0-10 y/o"
WHEN Age>11 AND Age<=20 THEN "11-20 y/o"
WHEN Age>21 AND Age<=30 THEN "21-30 y/o"
WHEN Age>31 THEN ">31 y/o"
END
My concern is that I want to be sure that all potential calculated fields are shown on my graph. Sometimes, I have no record in one field - for example no people between 21 and 30 y/o - so on my bar chart, I don't see "21-30 y/o" bar. I want to cover all age categories in my bar chart so, even if no people between 21 and 30 years, I want to see this field in the X-Dimension (like in an age pyramid in demographic studies).
我担心的是,我希望确保所有潜在的计算字段都显示在我的图表上。有时,我在一个领域没有记录--例如,没有21岁到30岁之间的人--所以在我的条形图上,我看不到“21-30岁”的条形图。我想要在我的条形图中涵盖所有年龄类别,因此,即使没有21到30岁的人,我也希望在X维度中看到这一领域(就像人口统计学研究中的年龄金字塔)。
What I Have
我所拥有的
Calculated_Age |
RecordCount |
1-10 y/o |
3 |
11-20 y/o |
6 |
>31 y/o |
10 |
What I Want
我想要的是
Calculated_Age |
RecordCount |
1-10 y/o |
3 |
11-20 y/o |
6 |
21-30 y/o |
0 |
>31 y/o |
10 |
Is it possible to force the X-Dimensions names to have all age ranges visible rather than having only age ranges with non zero record count. I use standard Looker Studio (not pro).
是否可以强制X-Dimensions名称显示所有年龄范围,而不是只显示具有非零记录计数的年龄范围。我用的是标准的Looker Studio(不是专业的)。
I'm beginning with Looker Studio so I tried only everything which is possible in standard. No success. I also tried to force RecordCount at Zero instead of null but also no success.
我从Looker Studio开始,所以我只尝试了标准版中可能的所有东西。没有成功。我还试图强制RecordCount为零而不是空,但也没有成功。
If don't use calculated fields, and I create a data source with split of data already done - as below - I obtain exactly what I need in term of bar chart. But no dynamic calculation so not interesting for me.
如果不使用计算字段,并且我创建了一个已完成数据拆分的数据源-如下所示-我就可以通过条形图准确地获得我需要的内容。但没有动态计算,所以我不感兴趣。
Modified Data Source with records manually counted
手动统计记录的已修改数据源
Calculated Age |
Record |
1-10 y/o |
3 |
11-20 y/o |
6 |
21-30 y/o |
0 |
>31 y/o |
10 |
Thank you by advance for your support.
预告感谢您的支持。
更多回答
steforom: This question Needs Details or Clarity, thus edit so it's self contained (Example) with 1) Data: 3-9 rows of Inputs (Markdown Table) with Sample Data set (Google: Sheets, Analytics, etc) 2) Expected output table 3) Chart: Configuration + Setup 4) Issue: Attempt at solving + Output / Error 5) Report: Publicly editable Looker Studio with 1-4. Without a minimal reproducible example it would be difficult to test suggestions & the issue could be general troubleshooting
Steforom:此问题需要详细或清晰,因此需要编辑,以便它是自包含的(示例)1)数据:3-9行输入(Markdown Table)与样本数据集(Google:Sheets,Analytics等)2)预期输出表3)图表:配置+设置4)问题:尝试解决+输出/错误5)报告:可公开编辑的Looker Studio 1-4。如果没有最小的可重现示例,将很难测试建议&问题可能是常规故障排除
With the revisions the question is clearer. Note that #5 - a publicly editable Looker Studio will make it easier for all users to easily test out, reproduce and provide solutions to the issue.
随着修订的进行,问题变得更加清晰。请注意,#5-可公开编辑的Looker Studio将使所有用户更容易测试、复制并提供问题的解决方案。
我是一名优秀的程序员,十分优秀!