If i have a table as show below.
ID | Name | Type | Qty |
---|---|---|---|
1 | A | Pork | 1 |
2 | B | Pork | 2 |
3 | C | Milk | 3 |
4 | D | Milk | 4 |
How should i select only not duplicate in column Type ?
If i use SELECT([Relate test][Type],True,True) , i only got list of Pork,Milk. But what i want is list of ID 1,3.
Solved! Go to Solution.
Maybe this?
SELECT(
[Related tests][ID],
ISBLANK(
FILTER(
"tests",
AND(
([_ROWNUMBER] < [_THISROW-1].[_ROWNUMBER]),
IN([ID], [_THISROW].[Related tests]),
([Type] = [_THISROW-1].[Type])
)
)
)
)
Please post a screenshot of your expression.
I just want to select any key row of each Type.
Maybe this?
SELECT(
[Related tests][ID],
ISBLANK(
FILTER(
"tests",
AND(
([_ROWNUMBER] < [_THISROW-1].[_ROWNUMBER]),
IN([ID], [_THISROW].[Related tests]),
([Type] = [_THISROW-1].[Type])
)
)
)
)
Work like miracle !!! Thank you very much, @Steve
I need to learn more about Filter now. Could you please explain more in details about this formula ? Why there have ISBLANK ? I am a bit confused.
The approach Iโve used is to include in the result only the first row of the tests table for each [Type]
found in the rows identified by [Related tests]
.
The SELECT() expression looks through each row in [Related tests]
. For each row, the FILTER() expression is performed to list the rows in tests that have the same [Type]
value and that occur in the [Related tests]
list and that have a lower row number. If there are no such rows (the result of FILTER() is an empty list, or โis blankโ), we know that the row weโre examining is the one with the lowest row number for that [Type]
value.
Thank you very much, @Steve
User | Count |
---|---|
18 | |
14 | |
11 | |
7 | |
4 |