Forum Discussion

ilooper's avatar
ilooper
Frequent Visitor
4 years ago
Solved

Filtered Sum in calculated column

Hello all,   I have what i feel should be easy problem to solve but my DAX isn't working.  I have a table that I would like to add a column that returns the sum of a column filtered.  Can I do that...
  • ilooper's avatar
    4 years ago

    I figured it out through measure.  The only problem is I can't (yet) roll up through the hierachy becasue of the filter context.

     

    Total Patients (Market/Month) =
    Var Market1 = SELECTEDVALUE(Invoice_Table_Master[Market])
    Var Month1 = SELECTEDVALUE(Invoice_Table_Master[Month])

    Return
    CALCULATE(SUM(Invoice_Table_Master[Patient Count on Inv.]),
    Invoice_Table_Master[Market] = Market1,
    Invoice_Table_Master[Month] = Month1,
    ALL(Invoice_Table_Master))