cancel
Showing results for
Did you mean:
Member

## Help with a calculated measure filtered on a column and slicer on same column

I have a very simple example table - purchases from vendors with item number, vendor name, amount and a paid flag (yes/no).

I have a measure that calculates the total amount:

Total Cost = SUM(Purchases[Cost])

A measure that calculates the total for paid line items:
Total Paid = CALCULATE([Total Cost], Purchases[Paid]="Yes")

% Paid = DIVIDE([Total Paid], [Total Cost])

I added two filters, one for the vendor, one for the Paid flag. I would expect when I select Paid=No, then the % Paid would be zero. This is not happening. When Paid=Yes, % Paid is correctly shown as 100%. The company fflter is working as expected.

The pbix file is attached.

1 ACCEPTED SOLUTION

Accepted Solutions
Senior Member

## Re: Help with a calculated measure filtered on a column and slicer on same column

try this measure for Total Paid:

```Total Paid =
CALCULATE ( [Total Cost], FILTER ( Purchases, Purchases[Paid] = "Yes" ) )```
4 REPLIES 4
Senior Member

## Re: Help with a calculated measure filtered on a column and slicer on same column

try this measure for Total Paid:

```Total Paid =
CALCULATE ( [Total Cost], FILTER ( Purchases, Purchases[Paid] = "Yes" ) )```
Member

## Re: Help with a calculated measure filtered on a column and slicer on same column

@NickNg278 Thanks a lot, this worked. Why does this work and not the other way around?

Senior Member

## Re: Help with a calculated measure filtered on a column and slicer on same column

The original Total Paid measure is overriding the filter context coming from your slicer, essentially it is equivalent of the following formula:

```Total Paid =
CALCULATE ( [Total Cost], FILTER ( ALL ( Purchase[Paid] ), Purchase[Paid] = "Yes" ) )```

ALL function ignore any filters coming from your data model. See reference here

Highlighted
Member

## Re: Help with a calculated measure filtered on a column and slicer on same column

@NickNg278 Makes sense, thanks.