How count each element

Linar
Participant I

I have a table like this:
a
a
a
b
b
c

Is it possible to display such a list using a list-type virtual column in the same table?
a 3 50%
b 2 33%
c 1 16%

p.s. sorry for google translator)

Solved Solved
0 2 128
1 ACCEPTED SOLUTION

Steve
Participant V

Ideally, youโ€™d have a separate table that contains only the distinct values, then you could use virtual columns to gather and present the desired stats.

If not that, add virtual columns for the desired stats to the existing table, then youโ€™ll want a slice of the original table that uses a row filter expression similar to this to include only one row per distinct column value:

(
  [_ROWNUMBER]
  = MIN(
    SELECT(
      table[_ROWNUMBER],
      ([column] = [_THISROW].[column])
    )
  )
)

where table is the name of the table, and column is the name of the column containing the values you want to present.

View solution in original post

2 REPLIES 2

Steve
Participant V

Ideally, youโ€™d have a separate table that contains only the distinct values, then you could use virtual columns to gather and present the desired stats.

If not that, add virtual columns for the desired stats to the existing table, then youโ€™ll want a slice of the original table that uses a row filter expression similar to this to include only one row per distinct column value:

(
  [_ROWNUMBER]
  = MIN(
    SELECT(
      table[_ROWNUMBER],
      ([column] = [_THISROW].[column])
    )
  )
)

where table is the name of the table, and column is the name of the column containing the values you want to present.

Thank you very much!

Top Labels in this Space