Skip to main content
Question

Alternative to long nested if

  • June 10, 2025
  • 3 replies
  • 64 views

Forum|alt.badge.img

Hello!

I seem to face a problem when constructing a trial balance for which i use nested ifs. So the formula goes like this 

IF('GL Accounts'='GL Accounts'."Revenue" ,'Revenue Staging',IF('GL Accounts'='GL Accounts'."Other income" ,'Other Income staging'))

So the condition is different for each list item in GL Account dimension (Which has 40 items)

When we try to use the nested ifs, it doesn’t allow us beyond 17 loops. Cannot use the switch statement as we have a different criteria for each list item. 

Have you guys gone through such a situation and found an alternative to long nested loops?

Thanks in advance for your help!

3 replies

Stef
Employee
Forum|alt.badge.img+12
  • Employee
  • June 10, 2025

Hello ​@Aravind !

If a SWITCH is not feasible (that would be the preferred option) what you could try is the following structure:

'Revenue Staging' [FILTER: 'GL Accounts'='GL Accounts'."Revenue" ] +
'Other Income staging' [FILTER: 'GL Accounts'='GL Accounts'."Other income"]

The example above should also work with SWITCH, but I’m unaware of any other conditions you might have but feel free to disclose them so we can review if using SWITCH is an option for your use case.


Forum|alt.badge.img
  • Author
  • Apprentice Author
  • June 10, 2025

Thanks Stef for the fast response! Appreciate it!

Will try with switch and filter and post the result here.


Forum|alt.badge.img
  • Author
  • Apprentice Author
  • June 10, 2025

It works. The arguments inside the switch metric must match that of the target metric. Thanks Stef!