question

AayushiSolanki-8981 avatar image
0 Votes"
AayushiSolanki-8981 asked SadiqhAhmed-MSFT answered

Seperate Last 3 months data

Using azure cost management API, how to get last three months data seperately.
Eg:
July, august september
{
"type": "Usage",
"timeframe": "TheLast3Months",
"dataset": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},

}
}


The above query give combined cost, how to modify query so that it gives each month data of last three month.

azure-cost-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SadiqhAhmed-MSFT avatar image
0 Votes"
SadiqhAhmed-MSFT answered

@AayushiSolanki-8981 Thank you for your patience and I apologize for the delayed response!

You cannot get the three month’s data “separately” based on the query you submitted. Consider Query as an API where you are submitting a workload for execution – and timeframe is an easy moniker to translate the date range you are querying the data for.

You have to make “Custom” time frame based queries for specific months cost data.

Said that, I’m curious to understand your scenario and wonder if Query API is the right API pattern for your use case. Can you please share more context on what you are trying to accomplish?


If the response helped, do "Accept Answer" and up-vote it

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.