Skip to main content

I have a XYZ input metric of data type: Boolean with dimension: Teams and
another metric ABC of data type: number with dimension Manager.

I need to create a metric at Manager level with dimension : Manager and data type: number , to fetch the amount from ABC if any of the teams of a specific manager is True.
There is already a mapping between manager and teams in the Teams dim list.
 

I tried this formula, but it gives the value even all the teams of a manager in XYZ metric is false.
 IF(ANYOF('t. XYZ XInput]'),'m. Amount')

Hi @pigment_enthusiast ,

If I understood what you are trying to achieve correctly, ANYOF would not be the correct function.

This function (ANYOF) would return TRUE if the input block contains at least one TRUE value and removes the dimensions of the block.
Since you are applying it on a metric having Manager dimension Pigment would align the structure and add Manager dimension which will apply true to all managers thus you will get true to all Managers:
 

To achieve what you are looking for I suggest using the BY Modifier combined with ANY Aggregator to map each team to its Manager. So your formula would be:

IF(XYZXBY ANY: teams.Manager],ABC)

where Manager is a property in my dimension teams.

Hope this helps,
Issam


Got it, it worked using ANY with BY modifier. Thanks!

Is there any documentation link for detailed description of ANYOF?
Also, does it work only if the source metric block and the target metric both has same dimensions ?


Unfortunately, there isn't any official documentation available for the detailed description of the ANYOF function at the moment. I apologize for any inconvenience this may cause.

However, you can see the syntax and expected output of the function by hovering over it, or by testing it in the playground.

To clarify, the ANYOF function removes all dimensions from the boolean blocks added in the argument. It will return True if at least one cell in the block is True.

It doesn't require the source metric block and the target metric to have the same dimensions to work correctly as it results in a metric with no dimensions.

Hope this provides more clarifications,
Issam


Yes, got it! Thank you for the detailed explanation.

So basically, here are the key findings for ANYOF function, feel free to add if I missed any.

  • Syntax: ANYOF(booleanBlock)
  • Arguments: booleanBlock [required] 
    This argument can be of any dimension(s)
    The datatype should be ‘boolean’
  • Returns: True {if the booleanBlock contains atleast one true value}
    Resultant removes all the dimension(s) of the booleanBlock.

Hi @pigment_enthusiast 
Thanks for your post! As a result we have created an article for this function.
It is here.
Thanks again!


Reply