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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mtrevisiol
Helper V
Helper V

How to show only rows where a date range includes the selected date

Hi everyone,

I've got a table that contains all the orders placed to suppliers, with the ID, the OrderDate, the supplier's name, the Unit of Measure, the Quantity, the Unit Value and the total amount paid:

 

mtrevisiol_1-1646065160073.png

 

Then I've got a table containing suppliers' price lists. It contains the list of items and, for each one, the date range within which a certain price is valid:

mtrevisiol_2-1646065403310.png

 

ValidityEndingDate = 31/12/2099 means that the price is currently valid.

 

My intent is to create a dashboard in which the user can click on a certain order (in the first table) and get the price that was valid at the moment of the order (from the second table).

Thus, I want to visualize in the second table only the specific row in which 'Table1'[OrderDate] is contained in the interval between  'Table2'[PriceListValidityStartingDate] and 'Table2'[PriceListValidityEndingDate].

 

For example:

 

mtrevisiol_3-1646066041435.png

 

I hope it's all clear. Here is the PBIX file with data: https://www.dropbox.com/s/0uki6v3dqkardja/PRICELISTS%20suppliers.pbix?dl=0

 

Many thanks

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mtrevisiol , Create all the measures like these or use that as visual level filter

 


var _max = maxx(allselected(Table1), Table[Order Date])
return
calculate( count(Table[Pirce]), filter(Table2, 'Table2'[PriceListValidityStartingDate] <= _max && 'Table2'[PriceListValidityEndingDate] >=_max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@mtrevisiol , Create all the measures like these or use that as visual level filter

 


var _max = maxx(allselected(Table1), Table[Order Date])
return
calculate( count(Table[Pirce]), filter(Table2, 'Table2'[PriceListValidityStartingDate] <= _max && 'Table2'[PriceListValidityEndingDate] >=_max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you so much @amitchandak 

I've used MAX instead of COUNT:

var _max = maxx(allselected(Table1), Table[Order Date])
return
calculate( MAX(Table[Pirce]), filter(Table2, 'Table2'[PriceListValidityStartingDate] <= _max && 'Table2'[PriceListValidityEndingDate] >=_max))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors