在Google Sheets中查询数据,以获取显示日变化的表格。

huangapple go评论64阅读模式
英文:

Query data in Google Sheets to get a table that shows day change

问题

有没有办法可以在Google表格中查询一些数据,以便不是得到一个总计表,而是得到每天的变化?

这是我的示例表格:https://docs.google.com/spreadsheets/d/1259GAJ2xzEgTMWJsX5QWsE8RbRXqeXJ0rt1Y_xRd5ls/edit?usp=sharing

我有一些数据显示每个视频的总览次数,它每天都会增加。我想要看到的是每个视频每天获得的总览次数。从数据中,这可以通过在每天获取的总数中减去前一天的值来计算。

让事情变得复杂(我希望在数据中清晰可见的)的是,会添加新的视频,所以它们需要与其他视频一起显示。

我已经能够轻松地查询和透视数据,但它仍然只显示每天视频的总览次数,我不知道如何使得相同的表格仅显示与前一天的变化。

英文:

Is there a way that I can query some data in Google Sheets so that, instead of getting a table of totals, I get a daily change?

Here is my example sheet: https://docs.google.com/spreadsheets/d/1259GAJ2xzEgTMWJsX5QWsE8RbRXqeXJ0rt1Y_xRd5ls/edit?usp=sharing

I have data that shows a total number of views for each video, and it increments each day. What I want to see instead is the total number of views that each video gets each day. From the data, that would be calculated by taking the total on each day and subtracting the previous day's value.

Complicating things (which I hope is clear in the data) is that new videos will be added, so they'll need to show up alongside the others.

I've been able to easily query and pivot the data, but it still just shows the total views for the video on each day, and I just don't know how to get that same table to show only the change from the previous day.

答案1

得分: 1

您可以尝试:

=map(A3:A, B3:B, C3:C, lambda(a, b, c, if(a="", , let(Λ, filter(A:A, B:B=b),
        {a, b, c - ifna(filter(C:C, B:B=b, A:A=xlookup(a-1, Λ, Λ, ,-1)))}))))

在Google Sheets中查询数据,以获取显示日变化的表格。

英文:

<!-- language-all: js -->

You may try:

=map(A3:A,B3:B,C3:C,lambda(a,b,c,if(a=&quot;&quot;,,let(Λ,filter(A:A,B:B=b),
        {a,b,c-ifna(filter(C:C,B:B=b,A:A=xlookup(a-1,Λ,Λ,,-1)))}))))

在Google Sheets中查询数据,以获取显示日变化的表格。

huangapple
  • 本文由 发表于 2023年7月14日 04:37:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76683090.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定