Table:
0
A
B
C
1
market id
country
number cities
2
1
Japan
209
3
2
China
540
4
3
USA
700
5
4
Russia
231
6
5
France
212
7
6
Poland
453

Questions and formulas:
Question: How many markets have number of cities smaller than 300?
Formula: SUM(LET(a,A1,b,A1,c,INDEX(LET(query1,SUMMARIZE(A1,SUMX(C1)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: SUM(LET(a,A2:A7,b,A2:A7,c,INDEX(LET(query1,SUMMARIZE(A2:A7,SUMX(C2:C7)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard
Question: Count the number of markets that have a number of cities lower than 300.
Formula: SUM(LET(a,A1,b,A1,c,INDEX(LET(query1,SUMMARIZE(A1,SUMX(C1)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: SUM(LET(a,A2:A7,b,A2:A7,c,INDEX(LET(query1,SUMMARIZE(A2:A7,SUMX(C2:C7)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard
Question: List all countries of markets in ascending alphabetical order.
Formula: SORT(UNIQUE(HSTACK(A1,B1)), 2, 1)
Formula2: SORT(UNIQUE(HSTACK(A2:A7,B2:B7)), 2, 1)
Level: medium
Question: What are the countries for each market, ordered alphabetically?
Formula: SORT(UNIQUE(HSTACK(A1,B1)), 2, 1)
Formula2: SORT(UNIQUE(HSTACK(A2:A7,B2:B7)), 2, 1)
Level: medium
Question: List all countries of markets in descending order of number of cities.
Formula: SORT(SUMMARIZE(HSTACK(B1,A1),SUMX(C1)), 3, -1)
Formula2: SORT(SUMMARIZE(HSTACK(B2:B7,A2:A7),SUMX(C2:C7)), 3, -1)
Level: hard
Question: How many markets include less than 300 cities?
Formula: SUM(LET(a,A1,b,A1,c,INDEX(LET(query1,SUMMARIZE(A1,SUMX(C1)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: SUM(LET(a,A2:A7,b,A2:A7,c,INDEX(LET(query1,SUMMARIZE(A2:A7,SUMX(C2:C7)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard
Question: The number of markets with a number of cities less than 300.
Formula: SUM(LET(a,A1,b,A1,c,INDEX(LET(query1,SUMMARIZE(A1,SUMX(C1)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: SUM(LET(a,A2:A7,b,A2:A7,c,INDEX(LET(query1,SUMMARIZE(A2:A7,SUMX(C2:C7)),FILTER(query1,CHOOSECOLS(query1,2)<300)),,1),FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard