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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
datamortar
Frequent Visitor

Measure with filtering from two date fields

I have a data model with a measure for order amount. For simplicity:
-Fact table has four columns: order number, order amount, delivery_date, order_date.
-The fact table is connected with a dim table (Calendar) to the order_date column.

 

I need to calculate orders for the current order_date period (filtered with a slicer) BUT
it should exclude orders with delivery_dates that are outside the region.


I have tried to explicitly define the filter in the calculate but it seems to always also
include the implicit filters and/or include too much of the dim. I would like to have the result on the same granularity as the fact. Any suggestions?

 

I have tried (to no avail) : 

order amount = CALCULATE(
SUM (Sales[orders]),

FILTER('Sales',
Sales[delivery_date] <= CALCULATE(
MAX('Calendar'[Date]),KEEPFILTERS('Calendar'[Date]))))

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @datamortar 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. I look forward to your response.

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi! Here is a snippet of the data with some of it randomized. https://www.dropbox.com/s/2k4vit6es7i0z49/question.pbix?dl=0

 

datamortar_0-1667589712434.png

The problem is now that I can't have the dim calendar in the resulting table.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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