How can we two different filters for two different values (fields) in same graph

Hey Guys,
How can we have two different filters for two different values (fields)

  • algo version (a_b_c) —> Actual Revenue (fields)
  • algo version (x_y_z) —> Monthly Imbalance (Fields)

I want to have above condition in the same visuals.

Thank you in advance!


image

Hi @Dhiru,
If I understand correctly, you may need to use a calculated field instead of a direct filter that would something like this:
ifelse(in({algo_version}, ['a', 'b', 'c']), {Actual Revenue}, in({algo_version}, ['x', 'y', 'z']), {Monthly Imbalance}, NULL)

Or, you could return each field dependent on whatever algo version if you’d like to use 2 separate calculated fields:

ifelse({algo_version} = 'a' {algo_version} = 'b' OR {algo_version} = 'c',  {Actual Revenue}, NULL)

ifelse({algo_version} = 'x' {algo_version} = 'y' OR {algo_version} = 'z',  {Monthly Imbalance}, NULL)

If you’re looking to accomplish something different, please provide some additional information so that I can assist!

Hello @Brett ,
Thank you for the quick response. I am trying to create the calculated field as you said but seems there is an syntax error:

ifelse(in({algo_version}, [‘Simple1a_1.b8’, ‘Simple1e5_1.f7’, ‘Simple4.5_1.992’, ‘Simple1.f_1.r9’]), {Imbalance Revenue Monthly Simulation}, in({algo_version}, [‘v2_intraqh_a_b_c’]), {Actual Revenue})

OR

ifelse( {algo_version}= ‘Simple1.a_1.b8’ {algo_version}= ‘Simple1e5_1.f7’ {algo_version}= ‘Simple4.5_1.992’ {algo_version}= ‘Simple1.f_1.d9’, {Imbalance Revenue Monthly Simulation}, NULL)
ifelse({algo_version} = ‘v2_intraqh_a_b_c’, {Actual Revenue}, NULL )

Hi @Dhiru,
The first note I would suggest is to try splitting up these calculations into 3 distinct fields:

Field 1:
ifelse(in({algo_version}, [‘Simple1a_1.b8’, ‘Simple1e5_1.f7’, ‘Simple4.5_1.992’, ‘Simple1.f_1.r9’]), {Imbalance Revenue Monthly Simulation}, in({algo_version}, [‘v2_intraqh_a_b_c’]), {Actual Revenue})

Field 2 (You’ll also need to add ‘OR’ in between - added below to assist):
ifelse( {algo_version}= ‘Simple1.a_1.b8’ OR {algo_version}= ‘Simple1e5_1.f7’ OR {algo_version}= ‘Simple4.5_1.992’ OR {algo_version}= ‘Simple1.f_1.d9’, {Imbalance Revenue Monthly Simulation}, NULL)

Field 3:
ifelse({algo_version} = ‘v2_intraqh_a_b_c’, {Actual Revenue}, NULL )

Hello Brett,
The above query worked just had another question related to that:
Suppose my algo versions are following:
Simple 1.5_23
Simple 1.5_12
Simple 1.5_42
Simple 1.5_62
Simple 1.0_44
Simple 1.0_56
Simple 1.0_22
Simple 1.0_67
Simple 2.0_81
Simple 2.0_92

And I am writing the below if else query

ifelse( {algo_version}= ‘Simple 1.5_23’ OR {algo_version}= ‘Simple 1.5_62’ OR {algo_version}= ‘Simple 1.5_42’ OR {algo_version}= ‘Simple 1.5_12’, {Imbalance Revenue Monthly Simulation}, NULL)

Now I want the above ‘ifelse’ command to select just the algorithm version starting from ‘Simple1.5_XX’ not other algo version(Simple1.0_XX; Simple2.0_XX).
Is there any other way to write the above query instead of writing each and every algo version?

Hi @Dhiru,
You could try using the contains() function to support this. Then you could just use the number that follows Simple…For example: contains(‘1.5’)

Let me know if that works for your case.

Thank you!

@Dhiru,
I saw you posted a new topic for your additional question so I’ll go ahead and close this one out and respond on your new topic!