Forum Discussion

brennahurley's avatar
brennahurley
Frequent Visitor
9 months ago
Solved

Help Understanding Calculate

I need help understanding when one should use the filter function within calculate. I have the two following DAX formulas:   (a)  var notTwoToThree = if(isblank(CALCULATE(         COUNTROWS(Fact...
  • danextian's avatar
    9 months ago

    Hi brennahurley 

     

    Your first measure will return a value for the row where in both of these conditions are satisfied: FactScoreChange[Name] = personName and FactScoreChange[Year Range] = "2022-2023". It  will return blank for everything else. It guarantees the user selection is preserved. Your second measure will return the filtered value for all rows of Year Range and Name

    Which one to choose depends on your use case. The second one can be used to compare a specific filtered value vs all other values for different rows -  for example Aparel and EMEA vs Apparel and APAC. As a best practice though, filtering a table is to be avoided and filtering columns instead. You can use KEEPFILTERS  on column to preserve the user selection instead of FILTER. The perfomance difference between the two is neglible on small tables.