Can the platform display Cost History data as a percentage of total rather than a sum?
search cancel

Can the platform display Cost History data as a percentage of total rather than a sum?

book

Article ID: 284407

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

It is possible to use FlexReports to create percentages based on a specific use-case.

i.e. Percentage to be shown instead of the cost amount, x % Prod and y % Non-prod


NOTE: We provide access to the SQL query but do not support building custom SQL within support. 

The set of SQL statements that we support in FlexReports is limited.

--
The following example query is using multiple data sources (AWS, Azure) and multiple temp tables.
Note: temp_<> needs to be replaced with your specific names.
 
In this case it is a basic multi-cloud report

{

"sqlStatement": "WITH \"temp_aws\" AS (SELECT timeInterval_Month AS Month, SUM(lineItem_UnblendedCost) AS Cost, 'AWS' AS Cloud FROM AWS_CUR GROUP BY timeInterval_Month), \"temp_azure\" AS (SELECT timeInterval_Month AS Month, SUM(CostInBillingCurrency) AS Cost, 'Azure' AS Cloud FROM AZURE_COST_USAGE GROUP BY timeInterval_Month),\"temp_all\" AS (SELECT Month, Cost, Cloud FROM cxtemp_aws UNION ALL SELECT Month, Cost, Cloud FROM cxtemp_azure) SELECT Month, Cost, Cloud FROM cxtemp_all",

"dataGranularity": "MONTHLY",

"timeRange": {

"last": 3

},

"limit": -1

}

 
Here is a static query with currency conversion

{

"sqlStatement": "SELECT timeInterval_Day AS Day, SUM(lineItem_UnblendedCost) AS SUM_lineItem_UnblendedCost, CONCAT('$ ' , CAST(CAST(SUM(LineItem_UnblendedCost * 0.82) AS DECIMAL(20,8)) AS VARCHAR)) AS ConvertedCostInPounds, CONCAT('$ ' , CAST(CAST(SUM(LineItem_UnblendedCost * 0.93) AS DECIMAL(20,8)) AS VARCHAR)) AS ConvertedCostEuros FROM AWS_CUR GROUP BY timeInterval_Day",

"needBackLinkingForTags": true,

"dataGranularity": "DAILY",

"timeRange": {

"from": "2023-03-01",

"to": "2023-03-31"

},

"limit": 100

}