Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
reyno1j
Frequent Visitor

Filtering table based on date table where selected date is between 2 date columns

HI there everyone,

 

I'm looking for some help as I have trawlled the internet to find a way to do this but I can't seem to find how to do it!

 

I have a table of data that has a Valid From Date and and Valid To Date columns within.  What I am trying to achieve is the user will pick a date from a drop-down slicer and if that date falls between the From and To dates, then it displays that data.

 

I did figure a way of doing this, but it requires using a measure wihch you then can't use in some visuals and I want all visuals on the page to be updated by the date selection.

 

I assume that this might need to be done within Power Query Editior / Advanced Editor as it would then filter the whole table and then any visuals linked to that talbe would then work but not sure how to do that (sorry, I'm self taught on Power BI).

 

If anyone has any ides on how I could achieve this or what they do if they use a From and To date method, I'd be very greatful in your help.

 

Thanks in advance

Jon

3 REPLIES 3
reyno1j
Frequent Visitor

I'm not sure I have explained what I am trying to do very well, so I thought I'd provide another update on this with the hopes its a bit more clear with examples.

 

In the screenshot below, I have my data table on the left and a list of dates on the right.  What I'd like to do is be able to select a date from the date table, like 01/07/2022 as shown in the screenshot, and the table on the left will filter based on this data if the data falls betwen the Valid From Date and the Valid To Date.

 

reyno1j_0-1657019085569.png

I managed to create the measure from my initial post but that only works if you apply it to visual filter in the filter pane, I can't apply it to the page or all pages.  In the report that I'm working on I have 13 visiuals / elements so applying it to each one is a bit risky.  We will be converting our Data Warehouse to be using Valid From and Valid To dates for all of our tables, so we need a solution to all the user to show what the data would show on the selected date.

 

I may be approaching this in completely wrong way, so I'm happy to hear peoples ideas as I'm a but stumped on what I can 

reyno1j
Frequent Visitor

Hey @tamerj1 

Thanks for the reply.  When I put the mesuare in the filter pane, it only works if I put it in the visual section and not the page or all pages sections.

 

reyno1j_0-1656935488038.png

Above is the measure that I have taken from a previous colleague who left and tweaked a bit but when I try and drag it into the filters pane for Page or All Pages, it doesn't allow me to add it.  (note, this is in a test page and the varialble is just the selected value for the date that the user would choose from the drop down list and would be named correctly when it's put into live)

tamerj1
Super User
Super User

Hi @reyno1j 
You don't have to use the filter measure in the visual. You can just place it in the filter pane of eaither the visual or the page and apply your condition. Please provide more details to further support you.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.