You can replace orders.id with the dimension you want to group by (in this case the Created At Time dimension). From there, you can get the grouped count like this:
${next_group_start_row} - ${group_start_row}
Breaking this down, the match function gets the row number of the first row that contains the current row’s value. So if rows 7-10 contain 2020-02-20 16:40:38, the match function will return 7 for each of those rows, which gives us the group_start_row calculation.
The next_group_start_row calculation reverses the list and applies the match function to find the last row for each group, making a few adjustments in the arithmetic to get to the next_group_start_row from there. In this case it should return 11 for rows 7-10, since that is the first appearance of the next timestamp, 2020-02-20 16:40:37.
Once you have the starting rows of the current group and the next group, you can simply subtract the two to get the grouped count.
It works!!! ��
Thank you @chris_seymour1 and @izzymiller
I highly recommend adding this to the official documentation!
BTW can i use this for other measures? ill use the above data as an example, if i want to smear the latest created_at_time per merchant_id max(created_at) over (partition by merchant_id)
can i use this logic?
Only thing left is to overcome the download limit when using Table Calculations ��
I’m really new to the looker environment. I would like to know how I can insert this solution above in this screen that I sent the print? That is my environment.
This solution is exactly something that I really need, but I didn’t understand where it is possible to apply these lines of my code.
Just want to mention that if your data has to be ordered by the measure, the groups, unfortunately, won’t make sense. Also if you have more than one dimension.
I really can’t wait for window functions in table calculations. I usually have two dimensions and one measure and would like to have % of total, % of total of the first dimension, and % of total of the second dimension..
Hi James, thanks for posting this. I was referring to the explore shared by Chris. If we are applying this to there, is there any way where we can find out which item is giving us maximum revenue
Is there anyway we can calculate Rank dense in Looker, the default Rank function is Skip, I mean if I have same values Looker skips and generated next rank .instead on continuous Rank.