Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rllysm0ll
Contributor

Set expression

if my data for Mode of Transport contains: Car, Motorcycle, Bus, Grab, Gojek, Taxi

how do i code to only select Grab, Gojek, Taxi in my chart?

tried this but it has an expression error:

[Mode of Transport] = {"GRAB","TAXI","GOJEK"}

Labels (1)
1 Solution

Accepted Solutions
Diego_780
Creator

I'm guessing that you want to filter the results with only those mode of transport, I think you can do two things with set expressions, filter by dimension with only, or filter with a measure and including those values.

By dimensions I usually do this, I´m assuming Mode of Transport is your dimension:

Aggr(Only({<[Mode of Transport] = {"GRAB","TAXI","GOJEK"}>} [Mode of Transport]), [Mode of Transport])

And if you have measures, you could put it in the measure like this:

= Sum(<[Mode of Transport] = {"GRAB","TAXI","GOJEK"}>} 1)

Maybe if you share your expressions i can assist you.

Best of luck!

View solution in original post

1 Reply
Diego_780
Creator

I'm guessing that you want to filter the results with only those mode of transport, I think you can do two things with set expressions, filter by dimension with only, or filter with a measure and including those values.

By dimensions I usually do this, I´m assuming Mode of Transport is your dimension:

Aggr(Only({<[Mode of Transport] = {"GRAB","TAXI","GOJEK"}>} [Mode of Transport]), [Mode of Transport])

And if you have measures, you could put it in the measure like this:

= Sum(<[Mode of Transport] = {"GRAB","TAXI","GOJEK"}>} 1)

Maybe if you share your expressions i can assist you.

Best of luck!