Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rule Request] To check if "Filter' is used to filter a column in a measure #36

Open
hemant1303 opened this issue Jul 30, 2020 · 1 comment

Comments

@hemant1303
Copy link

Hi

I need to create a rule to check whether a filter condition has been used in calculate to filter a column.

Lets say there is a fact table called Sales and it has an amount column and another column for category which has 4-5 different categories in it. Let’s say I would like to calculate sales amount for a certain category from the category column. There are 2 ways of writing a measure that filters a category column for a certain condition:-

Measure 1 = Calculate(Sum('Sales'[Amount]),'Sales'[Category]="Red")
Measure 2 = Calculate(Sum('Sales'[Amount]),Filter(' Sales ', Sales '[Category]="Red"))

Both measure are correct but measure 2 takes longer time and will eventually slowdown visual rendering. As per marco russo filter function shall never be used for filtering a column. I need to create a rule that checks If any measure in the model is doing it if yes than I would like to highlight it.

Regards

@m-kovalsky
Copy link

This rule is available in the following Best Practice Rules.
https://github.com/microsoft/Analysis-Services/tree/master/BestPracticeRules

See this rule: [DAX Expressions] Filter column values with proper syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants