大查询枢纽有特定要求

发布于 2025-02-08 07:49:46 字数 481 浏览 3 评论 0 原文

我在大查询中使用了枢轴,但这是一个特定的用例和我需要在Looker中显示的数据。我正在尝试Looker中的类似选项,但想知道我是否可以在大查询中显示此选项。

这就是我的数据(示例)大查询表是:

“表“

输出应如下:

​它是枢轴的,但是我需要分配如图所示(对于特定范围)的列名,对于6范围以及更多内容,我需要将枢轴列数据添加到一个。

我在 big_query 中看不到枢轴索引或类似索引。是否有办法在枢轴索引6左右之后总结列数据?有什么建议如何实现这一目标?

I have used pivot in big query, but here is a specific use case and the data that I need to show in looker. I am trying the similar option in looker but wanted to know if I can just show this in big query.

This is how my data (Sample) in BIG QUERY table is:

Sample data for table "BIG_QUERY"

The output should be as below:

Sample Output

If you look at it, it's pivoting but I need to assign the column names as shown (for the specific range) and for the range 6 and more, I need to add the pivot columns data into one.

I don't see pivot index or something like this in BIG_QUERY. Was thinking if there is a way to sum up the column data after pivot index 6 or so? Any suggestions how to achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人接听 2025-02-15 07:49:47

希望下面的方法会有所帮助,

SELECT * FROM (
  SELECT Node, bucket, total_code 
    FROM sample, UNNEST([RANGE_BUCKET(data1, [1, 2, 3, 4, 5, 6, 7])]) bucket
) PIVOT (SUM(total_code) `range` FOR bucket IN (1, 2, 3, 4, 5, 6, 7));

输出:

”在此处输入映像说明“

Hope below approach would be helpful,

SELECT * FROM (
  SELECT Node, bucket, total_code 
    FROM sample, UNNEST([RANGE_BUCKET(data1, [1, 2, 3, 4, 5, 6, 7])]) bucket
) PIVOT (SUM(total_code) `range` FOR bucket IN (1, 2, 3, 4, 5, 6, 7));

output:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文