Filter table visual based on maximum closest date to slicer in power bi

102 Views Asked by At

I have a table and a slicer (showing today’s date by default). I want when a user select a date from slicer, the table shows the closest date (date column in the table visual) to the selected in slicer. [enter image description here][1]

I tried to create a measure that shows max date less than selected date in slicer:

Also a filter that shows which records should show and which is not:

And used that filter in filter section.

The “max dates” shows me the correct number but when I want to compare it with date column in the table visual, the filter measure doesn’t show correct data. I tried to convert both “max dates” and date column to the same format both still didn’t work.

https://i.stack.imgur.com/6UdW1.png

Earlier it just shows 0 for filter but now it doesn't show anything: https://i.stack.imgur.com/0MXcq.png

Here is the PBIX file: https://drive.google.com/file/d/1QGpF9qhF5GsPUFgrO2rMHkSpMUU94XbF/view?usp=drive_link

1

There are 1 best solutions below

3
Sam Nseir On

Change your Filter to:

Filter = 
  COUNTROWS(
    FILTER('BankCard AccountSummary', [Date] = [max dates])
  )