Having function in SSAS


Having function

This is undocumented function in SSAS. Those who have worked with SQL Server knows that having is used to filter aggregate data. Same use here. In general we can get same result using filter function but having is more easy to understand and might be giving better result.

Lets see how can we use this.

We want only those customers who have internet sales amount is less than 1000

SELECT [Measures].[Internet Sales Amount] ON 0,
[Customer].[Customer].[Customer].MEMBERS
HAVING [Measures].[Internet Sales Amount] < 1000 ON 1 FROM [Adventure Works]

Same Query we can run using filter function also

SELECT [Measures].[Internet Sales Amount] ON 0,
FILTER([Customer].[Customer].[Customer].MEMBERS
, [Measures].[Internet Sales Amount] < 1000) ON 1 FROM [Adventure Works]

As we can see having is easily readable and easy to understand .

Leave a comment


Design a site like this with WordPress.com
Get started