4
votes

Let's say I have a table like this - [Orders]

Date        Amount  Category
12/12/2017  100      A
12/12/2017  200      B
12/12/2017  300      C
1/1/2018    400      A
1/1/2018    500      B

And I have a slicer for Category.

If only one single Value is selected, then a measure like this will work

CALCULATE(SUM(Orders[Amount]),FILTER(ALL(Orders), Orders[Category] = SelectedValue(Category))).

When more than one value is selected, how would you pass that inside the DAX Measure?

1

1 Answers

5
votes

Try this:

= CALCULATE(SUM(Orders[Amount])
      FILTER(ALL(Orders), Orders[Category] IN VALUES(Category)))

In most situations, you should just be able to write SUM(Orders[Amount]) and Power BI will automatically do the filtering for you based on the slicer.