# 自定义分析云账单

+关注继续查看

## 产品维度账单分析

### 分析各个云产品的费用组成

source:bill | select ProductName, sum(PretaxAmount) as fee  group by ProductName order by fee desc

### 分析各个云产品每天的费用变化

source:bill | select ProductName, sum(PretaxAmount) as fee , date_trunc('day',__time__) as t  group by ProductName ,t order by t    limit 1000

### 分析本月每个财务单元的费用组成

source:instance_bill | select CostUnit, sum(PretaxAmount) as fee   group by CostUnit order by fee    limit 1000

### 分析每个财务单元，每天的费用变化

source:instance_bill | select CostUnit, sum(PretaxAmount) as fee , date_trunc('day',__time__) as t   group by CostUnit,t order by t     limit 1000

### 分析OSS各个计费项目的使用量和费用组成

source:instance_bill  and productcode:oss |  select BillingItem as "计费项", round(sum(PretaxGrossAmount),3) as "费用", concat(cast(round(sum(Usage),3) as varchar),' ',arbitrary(UsageUnit)) as "用量" group by "计费项" order by "费用" desc

### 预付费和按量付费维度费用组成

source:bill | select SubscriptionType, sum(PretaxAmount) as fee group by SubscriptionType

### 资源组维度费用组成

source:instance_bill  | select ResourceGroup, sum(PretaxAmount) as fee group by ResourceGroup

### ECS各个实例的账单组成

source:instance_bill  and productcode:ecs| select  instanceId, sum(PretaxAmount) as fee group by instanceId

### 不同规格ECS的账单组成

source:instance_bill  and productcode:ecs| select  InstanceSpec, sum(PretaxAmount) as fee group by InstanceSpec

## 参考内置模板，编写自定义SQL

#背景 [云助手](https://help.aliyun.com/document_detail/64601.html?spm=a2c4g.11186623.3.3.b8401fe5L8CO6N)可以自动地、批量地执行日常维护命令。
1774 0

784 0

DOCTYPE> JavaScript 优雅，是一种岁月，它是历经生命种种而呈现出的一种淡若不惊，褪去了少时的稚嫩，而呈现出的一种成熟的韵味。一个优雅的人，一定有着独特的魅力，和饱满的，恬淡而丰盈的灵魂。
872 0
@自定义注解

828 0
+关注

+ 订阅