TabularEditor / BestPracticeRules

An official collection of standard Rules for use with Tabular Editor's Best Practice Analyzer.
120 stars 53 forks source link

[Rule Submit] Disable Attribute Hierarchies rule should not apply to columns referenced by PATH function #44

Open alwortman opened 3 years ago

alwortman commented 3 years ago

Some DAX functions require the IsAvailableInMDX property to be true, though documentation as to which functions require it is poor.

In order for the function PATH to work, both the parent and child column it references must have this property set to true. I've added one additional filter to the expression to exempt such columns from being flagged.

Relevant rule addition: and not ReferencedBy.AllColumns.Any(Expression.Contains(\"PATH(\"))

Full rule definition:

  {
    "ID": "DISABLE_ATTRIBUTE_HIERACHIES",
    "Name": "Disable attribute hierachies to decrease processing",
    "Category": "Metadata",
    "Description": "Disable Attribute hierarchies for hidden collumns. This will ensure faster processing. Exclude columns used in PATH function.",
    "Severity": 2,
    "Scope": "DataColumn",
    "Expression": "not IsVisible\r\nand IsAvailableInMDX\r\nand not UsedInHierarchies.Any()\r\nand not UsedInVariations.Any()\r\nand not UsedInSortBy.Any()\r\nand not ReferencedBy.AllColumns.Any(Expression.Contains(\"PATH(\"))",
    "FixExpression": "IsAvailableInMDX = false",
    "CompatibilityLevel": 1400,
    "Source":  "standard\\Metadata"
  }