Count rows a slice has on the "main" view

Hi there,

I'm sure that is possible to count how many rows each slice has in this "main" view with some kind of formula in a virtual column, but I don't really know how to get there.Captura de ecrรฃ_20230217_202121.pngCaptura de ecrรฃ_20230217_201932.pngCaptura de ecrรฃ_20230217_201703.png

Solved Solved
0 6 315
2 ACCEPTED SOLUTIONS

Oh I get it. You can't dynamically refer to a table or slice name, so you'd have to do:

SWITCH( [column] ,
  "slice1" , COUNT( slice1[key] ) ,
  "slice2" , COUNT( slice2[key] ) ,
  ...
)

View solution in original post

Maybe I missunderstood the "..." at the end, but that link was very helpfull
I was missing the "default" part at the end of the formula, being the correct one:

SWITCH( [column] ,
  "slice1" , COUNT( slice1[key] ) ,
  "slice2" , COUNT( slice2[key] ) ,
  ... , 
  "")

Thank you so much for your help!
 

View solution in original post

6 REPLIES 6

COUNT( slice[key-column] )

The thing is that I wanted a formula to create a virtual column with inside de "Calendรกrio" table, that took the name of the slice in the [link] column.Where the blue numbers are the numbers of rows in each sliceWhere the blue numbers are the numbers of rows in each slice

Oh I get it. You can't dynamically refer to a table or slice name, so you'd have to do:

SWITCH( [column] ,
  "slice1" , COUNT( slice1[key] ) ,
  "slice2" , COUNT( slice2[key] ) ,
  ...
)

I've tried what you said:

Switch([link];
"Deadline_Atraso" ; COUNT(Deadline_Atraso[CodId]))

But for some reason it's returning this as an error:
"SWITCH function is used incorrectly: Inputs to SWITCH() must be an initial expression, one or more value-result pairs, and a default result"

Am I doing something wrong?

Rodrigo44_0-1676994272054.png

 




Maybe I missunderstood the "..." at the end, but that link was very helpfull
I was missing the "default" part at the end of the formula, being the correct one:

SWITCH( [column] ,
  "slice1" , COUNT( slice1[key] ) ,
  "slice2" , COUNT( slice2[key] ) ,
  ... , 
  "")

Thank you so much for your help!
 

Top Labels in this Space