Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Sum by Group

Happy Wednesday, Can you please suggest for below scenario? I want to sum sales amount and invoice if “ADVICE” and “KEY” are same,I tried if condition but not able to figure it out the result. ...
  • Cmcmahan's avatar
    Cmcmahan
    7 years ago

    Sure.  You've got a slight mistake in how you're setting up the query.  Remember, FILTER returns a table, so use that for the table you're summing across in your SUMX.  I just replaced the first '2018 RAW Data' term with your FILTER term:

     

    SalesTotal = SUMX(FILTER('2018 RAW Data', '2018 RAW Data'[advice] = SELECTEDVALUE('2018 RAW Data'[advice]) && '2018 RAW Data'[Key] = SELECTEDVALUE('2018 RAW Data','2018 RAW Data'[Key])), '2018 RAW Data'[Sales Amount])

     

    I think there are other issues (like you name a table then a column in your second SELECTEDVALUE when you only need the column), but this should get you started.