IBM Cloudability

Cloudability

A place for Cloudability product users to learn, connect, share and grow together.


#Cloudability
#Automation
 View Only
Expand all | Collapse all

Business Metrics Filter Value Expression

  • 1.  Business Metrics Filter Value Expression

    Posted Wed November 22, 2023 12:46 PM

    Can business metrics implement filters on the values? What I'm trying to do is get a column for 'Total Cost without Credits.' 

    So I might have three columns, 1 dimension (month) and 2 metrics: Total Cost & Usage Cost. This saves me from having to generate and merge two different reports.

    I thought something like this would work

    ```

                "name": "Total Usage Cost",
                "index": 3,
                "kind": "BUSINESS_METRIC",
                "preMatchExpression": "(DIMENSION['vendor'] == 'amazon' || DIMENSION['vendor'] == 'azure' || DIMENSION['vendor'] == 'gcp')",
                "defaultValue": "METRIC['unblended_cost']",
                "numberFormat": "currency",
                "updatedAt": "2023-11-10T22:26:12.669Z",
                "statements": [
                    {
                        "matchExpression": "DIMENSION['transaction_type'] == 'usage'",
                        "valueExpression": "METRIC['unblended_cost']"
                    }
                ]
            }

    ```

    but it just returns the unblended cost, not a filtered number applied to the unblended cost. I am trying to see if the valueExpression can output the usage number, not the the total unblended cost. 


    #Cloudability


  • 2.  RE: Business Metrics Filter Value Expression

    Posted Mon November 27, 2023 09:35 AM

    Hi Adam, 

    I think that the problem you're having is that your default value is the same as your value expression. Logically it works out to "if the transaction is NOT usage give me the unblended rate OR if the transaction IS = usage give me the unblended rate."

    The result is that you always get an unblended rate value regardless of the transaction type. Your defaultValueExpression should be "0" (zero) and then you'll get only the matched expression result that you want in the output.