How to group a column when the column type is an expression?

(AndinetA) #1

is it possible to group a column (“aggregation”: "simple”) of an expression type?

I tried the following and its not working.

{

"format": "default",

"expression": {      

   "test": {

//ASSIGN STATUS TEXT BASED ON DOC COUNT

}

  "expression_if_true": { },

  "type": "conditional",

  "expression_if_false":  {      }

},

"aggregation": "count_unique",  //NOT Working

"column_id": "status",

"visible": true,

"type": "expression",

"display": "status"

},
and Here is the current report

j

I wanted the report to be like this

Health center Name , Status , Numb of Users

Adecharke , Least Active , 3

Gacheno ,Least Active , 2

Is there any other way to achieve this?

0 Likes

(Cory Zue) #2

This is currently not possible since the expressions run off the compiled row and the aggregations happen in the database.

I think the simplest thing to do would be to port the expression column to the data source and then use a normal field column off that. Is that an option for you?

0 Likes

(AndinetA) #3

The Expression column(status) is computed from another report column(doc count) which is already an aggregation of count_unique.
The status column can also be done via conditional aggregation , but conditional aggregation only works for static reports and also, I don`t know if aggregation by count works on conditional aggregation type column.

0 Likes