diff --git a/BestPracticeRules/BPARules.json b/BestPracticeRules/BPARules.json index 5bf7ab2..b22bbce 100644 --- a/BestPracticeRules/BPARules.json +++ b/BestPracticeRules/BPARules.json @@ -337,7 +337,7 @@ "Description": "Inactive relationships are activated using the USERELATIONSHIP function. If an inactive relationship is not referenced in any measure via this function, the relationship will not be used. It should be determined whether the relationship is not necessary or to activate the relationship via this method.\r\n\r\nReference: https://docs.microsoft.com/power-bi/guidance/relationships-active-inactive\r\nReference: https://dax.guide/userelationship/", "Severity": 2, "Scope": "Relationship", - "Expression": "IsActive == false\r\nand not\r\n(\r\nModel.AllMeasures.Any(RegEx.IsMatch(Expression,\r\n\"(?i)USERELATIONSHIP\\s*\\(\\s*\\'*\" +\r\ncurrent.FromTable.Name + \"\\'*\\[\" + \r\ncurrent.FromColumn.Name + \"\\]\\s*,\\s*\\'*\" +\r\ncurrent.ToTable.Name + \"\\'*\\[\" +\r\ncurrent.ToColumn.Name + \"\\]\"))\r\nor\r\nModel.AllCalculationItems.Any(RegEx.IsMatch(Expression,\r\n\"(?i)USERELATIONSHIP\\s*\\(\\s*\\'*\" +\r\ncurrent.FromTable.Name + \"\\'*\\[\" + \r\ncurrent.FromColumn.Name + \"\\]\\s*,\\s*\\'*\" +\r\ncurrent.ToTable.Name + \"\\'*\\[\" +\r\ncurrent.ToColumn.Name + \"\\]\"))\r\n)", + "Expression": "IsActive == false\r\nand not\r\n(\r\n Model.AllMeasures.Any(\r\n RegEx.IsMatch(Expression, \"(?i)USERELATIONSHIP\\s*\\(\\s*'*\" + RegEx.Escape(current.FromTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.FromColumn.Name) + \"\\]\\s*,\\s*'*\" + RegEx.Escape(current.ToTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.ToColumn.Name) + \"\\]\")\r\n or RegEx.IsMatch(Expression, \"(?i)USERELATIONSHIP\\s*\\(\\s*'*\" + RegEx.Escape(current.ToTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.ToColumn.Name) + \"\\]\\s*,\\s*'*\" + RegEx.Escape(current.FromTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.FromColumn.Name) + \"\\]\")\r\n )\r\n or Model.AllCalculationItems.Any(\r\n RegEx.IsMatch(Expression, \"(?i)USERELATIONSHIP\\s*\\(\\s*'*\" + RegEx.Escape(current.FromTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.FromColumn.Name) + \"\\]\\s*,\\s*'*\" + RegEx.Escape(current.ToTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.ToColumn.Name) + \"\\]\")\r\n or RegEx.IsMatch(Expression, \"(?i)USERELATIONSHIP\\s*\\(\\s*'*\" + RegEx.Escape(current.ToTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.ToColumn.Name) + \"\\]\\s*,\\s*'*\" + RegEx.Escape(current.FromTable.Name) + \"'*\\s*\\[\" + RegEx.Escape(current.FromColumn.Name) + \"\\]\")\r\n )\r\n)", "CompatibilityLevel": 1200 }, {