Expanding on the conversation from this blog written by Arpita Ghosh, How to Differ CALCULATETABLE over FILTER in DAX, I wanted to clearly layout the different combinations you can come across, particularly when used with table variables.
Here I demonstrate 6 ways to look at these:
CalculateTable() with AddColumns() Inside
CalculateTable() with AddColumns() Outside
CalculateTable() with AddColumns() Outside with Calculate()
Filter() with AddColumns() Inside
Filter() with AddColumns() Outside
Filter() with AddColumns() Outside with Calculate()
The Alien Says... Do not use #2 or #3. All other methods can be correct depending on your situation, but #2 and #3 just need to be avoided. They return incorrect results as we can see below.
- Synopsis -
Method | Results in... | Use or Lose |
1) CalculateTable with AddColumns |