Table:
0
A
B
C
D
E
F
G
1
booking id
product id
returned yes or no
returned late yes or no
booked count
booked amount
products booked
2
4
1
1
1
5
309.73
3
14
1
1
0
3
102.76
4
13
3
1
0
4
151.68
5
11
1
1
1
1
344.38
6
15
3
1
0
2
236.13
7
10
4
1
0
6
123.43
8
14
5
1
1
6
351.38
9
11
5
1
1
3
146.01
10
3
5
1
1
3
189.16
11
15
1
1
0
1
398.68
12
2
4
1
1
9
290.72
13
1
2
1
0
5
110.2

Questions and formulas:
Question: What is the id of the product that is booked for 3 times?
Formula: LET(a,HSTACK(A1,B1),b,B1,c,CHOOSECOLS(LET(query1,SUMMARIZE(B1,SUMX(F1)),FILTER(query1,CHOOSECOLS(query1,2)=3)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: LET(a,HSTACK(A2:A13,B2:B13),b,B2:B13,c,CHOOSECOLS(LET(query1,SUMMARIZE(B2:B13,SUMX(F2:F13)),FILTER(query1,CHOOSECOLS(query1,2)=3)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard