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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jarwest
Helper II
Helper II

Filtering Data Based on a Date Table and 2 Date Columns in a Second Table

Hey all,

I have a table with 2 date columns, DateBought and DateSold. Every item in the report will have a date bought value, since all items in the date were bought, but items that have not been sold will have a null DateSold table. I've made a mockup table below.

IDDateBoughtDateSold
11/1/20221/10/2022
21/3/2022 
31/6/20221/14/2022
41/7/2022 
51/10/20221/11/2022
61/15/20221/16/2022
71/17/2022 
81/20/20221/22/2022
91/22/2022 

I want to create a slicer that will allow me to filter to if one of the columns is in the date range.

So, for example, if the date range is 1/10/2022 to 1/14/2022, it should return the columns 1, 3, and 5. From there, I want to count how many were bought in this time range (DateBought is in the range of the slicer) and how many were sold in this time range (DateSold is in the range of the slicer). For the example as before, there was 1 bought (5) and 3 sold (1, 3, and 5) during this time range.

 

Any advice is greatly appreciated. I can split the data so that its two separate tables with the same columns, just with the values already bought or sold split into separate tables.

2 REPLIES 2
amitchandak
Super User
Super User

@jarwest , You need to create a date table and join both dates with that. One join will be active and one will be inactive, you can use userelationship in measure to activate the join

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Wouldn't that filter if both dates are in range? I need to filter on if DateBought or DateSold are in this range, but if I understand this correctly it would filter on if DateBought and DateSold are in this range.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.