Count if support?

Answered
Phan Trần Hồng Phúc asked on March 18, 2019

Hi,

I have a question about measure. Do we have any feature about countif and sumif?
I have a array data (JSON Type) like 

[{
"productGroup":"Land Train",
"product":"Land Train Day Ticket",
"ticketType":"Adult",
"status":1
},
{
"productGroup":"Land Train",
"product":"Land Train Day Ticket",
"ticketType":"Adult",
"status":0
},
{
"productGroup":"Land Train",
"product":"Land Train Day Ticket",
"ticketType":"Adult",
"status":1
},
{
"productGroup":"Land Train",
"product":"Land Train Day Ticket",
"ticketType":"Adult",
"status":2
}]

I want group by "productGroup", "product", "ticketType" and the "status" field will be separated into 3 columns: "Valid" (Status = 0), "Suspect" (Status = 1), "Suspect Accepted" (status = 2). 

How can I do this?  Valid, Suspect, Suspect Accepted will be counted with the corresponding value

2 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster March 18, 2019

Hello Phan Trần Hồng Phúc,
Thank you for posting your question here.
Please refer to the following JSFiddle example: https://jsfiddle.net/flexmonster/kfq64xm0/.
It is based on the several calculated values calculated on the original field.
Does the suggested approach solve the case?
Waiting for your feedback.
Regards,
Dmytro

Public
Phan Trần Hồng Phúc March 19, 2019

Thanks. 
 

Please login or Register to Submit Answer