DAX: Using filter and summarize in same Query


In this SQL Query we are grouping Sales by Year and Color plus adding a filter of 5000

select CalendarYear,color,sum(SalesAmount) from [DimProduct] join FactInternetSales
on DimProduct.[ProductKey]=FactInternetSales.[ProductKey]
join DimDate
on dimdate.datekey=FactInternetSales.OrderDatekey
Group by CalendarYear,color
Having sum(salesamount)>5000
order by CalendarYear,color

image

 

Equivalent Dax of achieving same is:

evaluate( filter (summarize (‘Internet Sales’, ‘Date'[Calendar Year],
‘Product'[Color] ,"Sales Amount",sum(‘Internet Sales'[Sales Amount]))
,Calculate(sum(‘Internet Sales'[Sales Amount]))>5000))
order by ‘Date'[Calendar Year],
‘Product'[Color]

image

Comments (1)

  1. Srikanth Kota says:

    Is it mandate that we need to have the column in Summarize part if we want to use as Filter?

Skip to main content