Сравнение версий
по сравнению с
Ключ
- Эта строка добавлена.
- Эта строка удалена.
- Изменено форматирование.
Функция фильтрации.
Синтаксис
FILTER ( <Table>, <FilterExpression> )
Примечание |
---|
|
Пример
Использование функции FILTER для лимитирования:
Блок кода | ||
---|---|---|
| ||
DEFINE VAR GeneralGroupBy = SUMMARIZECOLUMNS ( 'Sales'[ProductCategory], 'Sales'[ProductSubcategory], 'Sales'[BrandName], "cost",CALCULATE ( SUM ( 'Sales'[SalesAmount] ) ) VAR GroupByCategorySubcatory = SUMMARIZE ( GeneralGroupBy, 'Sales'[ProductCategory], 'Sales'[ProductSubcategory] ) VAR TopByCategorySubcatory = TOPN ( FILTER ( 5, GroupByCategorySubcatory, 'Sales'[ProductCategory], ASC, 'Sales'[ProductSubcategory], ASC ) VAR GroupByBrand = SUMMARIZE ( GeneralGroupBy, 'Sales'[BrandName] ) VAR TopByBrand = TOPN ( 5, GroupByBrand, 'Sales'[BrandName], ASC ) EVALUATE TopByCategorySubcatory ORDER BY 'Sales'[ProductCategory] ASC EVALUATE FILTER ( GeneralGroupBy, AND ( ( 'Sales'[ProductCategory], 'Sales'[ProductSubcategory] ) IN TopByCategorySubcatory, ( 'Sales'[BrandName] ) IN TopByBrand ) ) | ||
Блок кода | ||
| ||
{ "results": [ { "cols": [ { "field": "ProductCategory", "dataType": "String" }, { "field": "ProductSubcategory", "dataType": "String" } ], "values": [ [ "Audio", "Bluetooth Headphones" ], [ "Audio", "MP4&MP3" ], [ "Audio", "Recording Pen" ], [ "Cameras and camcorders", "Camcorders" ], [ "Cameras and camcorders", "Cameras & Camcorders Accessories" ] ] }, { "cols": [ { "field": "ProductCategory", "dataType": "String" }, { "field": "ProductSubcategory", "dataType": "String" }, { "field": "BrandName", "dataType": "String" }, { "field": "cost", "dataType": "Double" } ], "values": [ [ "Audio", "MP4&MP3", "Contoso", 65168188 ], [ "Cameras and camcorders", "Cameras & Camcorders Accessories", "Contoso", 51599808 ], [ "Cameras and camcorders", "Camcorders", "Fabrikam", 1335285231 ] ] } ) ] } ) |
Смотрите также
📄 Моделирование данных с помощью DAX
📄 Поддерживаемые функции DAX
📄 Математические операторы