Table:
0
A
B
C
D
1
document id
budget type code
document details
documents with expenses
2
57
GV
government
3
192
GV
government
4
226
GV
government
5
227
GV
government
6
240
GV
government
7
300
GV
government
8
309
SF
safety
9
367
SF
safety
10
371
ORG
organization
11
383
ORG
organization

Questions and formulas:
Question: How many documents have expenses?
Formula: ROWS(UNIQUE(D1))
Formula2: ROWS(UNIQUE(D2:D11))
Level: easy
Question: Count the number of documents with expenses.
Formula: ROWS(UNIQUE(D1))
Formula2: ROWS(UNIQUE(D2:D11))
Level: easy
Question: What are the document ids for the budget type code 'SF'?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:D1,B1="sf"),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:D11,B2:B11="sf"),1))
Level: medium
Question: Give the ids of documents with expenses that have the budget code 'SF'.
Formula: LET(a,HSTACK(A1,D1),b,D1,c,CHOOSECOLS(UNIQUE(CHOOSECOLS(FILTER(A1:D1,B1="sf"),4)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: LET(a,HSTACK(A2:A11,D2:D11),b,D2:D11,c,CHOOSECOLS(UNIQUE(CHOOSECOLS(FILTER(A2:D11,B2:B11="sf"),4)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard
Question: Show budget type codes and the number of documents in each budget type.
Formula: SUMMARIZE(B1,SUMX(A1))
Formula2: SUMMARIZE(B2:B11,SUMX(A2:A11))
Level: easy
Question: What is the budget type code with most number of documents.
Formula: TAKE(SORT(SUMMARIZE(B1,SUMX(A1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(B2:B11,SUMX(A2:A11)), 2, -1), 1)
Level: hard
Question: Give the budget type code that is most common
Formula: TAKE(SORT(SUMMARIZE(B1,COUNTX(B1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(B2:B11,COUNTX(B2:B11)), 2, -1), 1)
Level: hard