# Filter replacement inside matrix with visual filter

I have a matrix displaying a sum of sales quantity and I have a slicer picking date periods.

I am displaying the sum of sales qty. I am also displaying the sum of sales for all dates (using ALL()) and that is working fine.

I am also attempting to show the sales quantity for date period 1 inside the matrix as a baseline and that is not working. I expected my stated filter context to replace the existing filter context, but it seems to be getting intersected. If date period 1 is in the slicer selection, it displays correctly, but if date period 1 is not, it is blank.

I hope Iâ€™m just doing something silly here, but if this canâ€™t work for some reason, I would have to remove the visual filter and then â€śmanuallyâ€ť apply the slicer to the salesqty. I tried that in the second matrix but couldnâ€™t get that working either.

Appreciate any assistance. PBIX at https://www.dropbox.com/s/vgpvkq36k3uo9lg/baseline%20inside%20matrix%20with%20slicer.pbix?dl=0.

Thanks.

-jpr

Hello @jpr,

Thank You for posting your query onto the Forum.

As you pointed it out correctly, that there must be something silling happening here and yes it does.

So since you wanted to achieve the results for â€śDate Period 1â€ť irrespective of the slicer selection. There will just be a minor tweak in the formula. Just remove the â€śFILTERâ€ť function from the formula and place it as â€śFILTERâ€ť condition inside the â€śCALCULATEâ€ť function directly and youâ€™ll get the results. So this is how the formula will be -

SalesInPeriod1 - Harsh =
CALCULATE( SUM( 'fact Sales2'[SalesQty] ) ,
'dim DatePeriod'[DatePeriod] = 1 )

And now, if you make any selections into the slicer itâ€™ll not affect the results and will continue to show the results for Date Period 1. Below is the screenshot of the results provided for the reference -

Iâ€™m also attaching the working of the PBIX file for the reference.

Hoping you find this useful and meets your requirements that youâ€™ve been looking for.

Thanks and Warm Regards,
Harsh

1 Like

Thanks, Harsh. That was indeed a silly mistake that â€ślooked rightâ€ť to me due to lack of experience.