Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Why does this formula work? Filter(all(...

Hi   The following formula allows me to sum YTD sales to a week selected on my date slicer:   YTD Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Number]<=max('Date'[Week Numbe...
  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    Anonymous 

    Yes, I know it is confusing...It takes a while to get your head around it (I've been at this for over 3 years and I learn stuff every day!).

    We are back to a previous stage in the explanation. The whole FILTER expression contains 2 parts:

    1) ALL removes the filters from the date table

    2) THEN the second filter expression kicks in. What it's doing is seeing an unfiltered dates table (since ALL has removed the filters), and then it returns the values established in the second expression over the whole dates table. Since the second filter expression checks the week number column, which does have a value "selected", it applies the new filter based on that selected value.

    Your second expression refers to the value selected in the week number column and a year. So it applies the filters accordingly over the whole date table.