Forum Discussion

bartvana's avatar
bartvana
Iron Contributor
Mar 24, 2022
Solved

DAX Calculate Sum with Filter

I would expect in the below example that in the column "ReplByQty", the first row would be 45 + 14 = 59. What am I doing wrong? Attached the sample workbook.
  • SergeiBaklan's avatar
    Mar 24, 2022

    bartvana 

    That is

    =VAR currentSKU=Table1[SKU]
    RETURN CALCULATE( SUM( Table1[Qty] ),
           FILTER( Table1, Table1[ReplBy] = currentSKU ) )

    Variable is evaluating first and fixed in Returned formula

Resources