locked
Calculating sum of a value for subset of rows RRS feed

  • Question

  • I have a dataset. I want to add a calculated measure that gives the total cost for each set of rows grouped by CaseID. An example below shows the table layout, and the "Total Case Cost" column is the one i am trying to calculate. Can someone point me in the right direction with the Dax? Ive tried using SUMMARIZE but cant get it to work:

    CaseID TestCode BatchCode TestCost Total Case Cost
    A001 A1 A 20 65
    A001 A1 B 20 65
    A001 A2 A 15 65
    A001 A3 A 10 65
    A002 B4 A 50 70
    A002 B5 A 20 70

    Thanks!


    Tuesday, August 12, 2014 12:33 PM

Answers

  • Found my solution myself, in case it helps anyone, here it is:

    Total Cost Per Case:=CALCULATE(SUM([TesCcost]),ALLEXCEPT(TableName, Detail[CaseID]))
    • Marked as answer by winstonSmith Tuesday, August 12, 2014 12:48 PM
    Tuesday, August 12, 2014 12:48 PM