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
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
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.

Top Solution Authors