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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Am I fundamentally misunderstanding date tables?

Hi Everyone  -  So, I have a calendar table that I have marked as a date table.   The calendar table is one downloaded from Marco's site, so I know it is legitimate.  

 

I have a shipping table...with dates of when orders have shipped.   There are other dates in that table as well, such as invoice date, etc.

 

I have a relationship setup between "date shipped" in the shipping table, and the Date field in my Date Table.   

 

I had thought that these two dates could be used interchangeably once the relationhip was created, and the date table was formally recognized as a "date table".    And furthermore, that you could essentially use the date table for ALL date related measures since it was linked to multiple other tables that have dates (such as my Orders table, the Shipping Table, etc).   

 

However, I am finding that when a TotalMTD calculation, I must use the date in the shipping table.   If I try and use the Date Table, I get (Blank).     TotalYTD works....but TotalMTD does not.    

 

Likewise if I try a week to date calculation, such as the one below, I also have to use the dates from my shipping table...I get an error if try and use the date table.  

 

Week to Date Shipments2 =
var CurrentDate=LASTDATE('FLU_Shipped Orders'[Date Shipped])
var DayNumberOfWeek=WEEKDAY(LASTDATE('FLU_Shipped Orders'[Date Shipped]),3)
return
CALCULATE(sum('FLU_Shipped Orders'[Shipped Price]),
DATESBETWEEN(
    'FLU_Shipped Orders'[Date Shipped],
DATEADD(
    CurrentDate,
    -1*DayNumberOfWeek,
    DAY),
    CurrentDate))

 

 

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

I'm not so sure for your data structure and relationships, can you please share some sample data for test? 

How to Get Your Question Answered Quickly
In addition, you can try to use date functions to manually calculate filtered date range:

Week to Date Shipments2 =
VAR CurrentDate =
    MAX ( Calendar[Date] )
VAR DayNumberOfWeek =
    WEEKDAY ( CurrentDate, 3 )
RETURN
    CALCULATE (
        SUM ( 'FLU_Shipped Orders'[Shipped Price] ),
        FILTER (
            ALLSELECTED ( 'FLU_Shipped Orders' ),
            'FLU_Shipped Orders'[Date Shipped]
                >= DATE ( YEAR ( CurrentDate ), MONTH ( CurrentDate ), DAY ( CurrentDate ) - 1 * DayNumberOfWeek )
                && 'FLU_Shipped Orders'[Date Shipped] <= CurrentDate
        )
    )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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