08.2 理解REMOVEFILTERS
# REMOVEFILTERS
2019-10-30分类:CALCULATE 调节器阅读(31)评论(0)阅读约需5分钟## 语法
移除指定表或列中的筛选器。REMOVEFILTERS ( [], [ [, [, … ] ] ] )REMOVEFILTERS是ALL函数的别名,但它只能用作CALCULATE调节器,起到移除筛选器的作用,不能像ALL那样用作表表达式。为了使ALL函数的语义更为清晰,建议在移除筛选器的时候使用REMOVEFILTERS## 实例
DEFINEMEASURE FactInternetSales[TotalSales]=SUM(FactInternetSales[SalesAmount])MEASURE FactInternetSales[%Sales]=DIVIDE([TotalSales],CALCULATE([TotalSales],REMOVEFILTERS()))EVALUATESUMMARIZECOLUMNS(ROLLUPADDISSUBTOTAL(DimProductCategory[EnglishProductCategoryName],”IsGrandTotal”),”TotalSales”,[TotalSales],”%Sales”,[%Sales])ORDER BY[IsGrandTotal]DESC,[TotalSales]DESCREMOVEFILTERS移除了外部的所有筛选器,使得[%Sales]的分母可以正确计算总计值| DimProductCategory[EnglishProductCategoryName] | [IsGrandTotal] | [TotalSales] | [%Sales] |
| :—-: | :—-: | :—-: | :—-: |
| Row1 | True | 29358677.2207 | 1 |
| Bikes | False | 28318144.6507 | 0.9645 |
| Accessories | False | 700759.96 | 0.0238 |
| Clothing | False | 339772.61 | 0.0116 |