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! Learn more

Reply
calen
Helper I
Helper I

Date Difference by Items First Ship Date

Good Morning Everyone!

 

I am trying to create a BI report to tracks the success of new projects. Sales gives me their projected volumes for years 1, 2, and 3. I need a measure that looks at the first ship date (Posting Date) for the selected item and then groups it into year 1, 2, or 3. I tried 

Day Difference = DATEDIFF(MIN('Item Ledger Entries'[Posting Date]), AVERAGE('Item Ledger Entries'[Posting Date]),Day). From there I can just group days into their respective year. The problem is it keeps looking at the minimum posting date for all projects, not a specific project. 
Any thoughts on how I can get this working?
 
Thanks!
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@calen 

I'm assuming you want this as a calculated column in your table.  That would be something like this.

Days = 
VAR _ThisDate = 'Item Ledger Entries'[Posting Date]
VAR _ProjStart = CALCULATE ( MIN ( 'Item Ledger Entries'[Posting Date] ), ALLEXCEPT ( 'Item Ledger Entries', 'Item Ledger Entries'[Project] ) )
RETURN
    DATEDIFF ( _ProjStart, _ThisDate, DAY )

jdbuchanan71_0-1617285617585.png

 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@calen 

I'm assuming you want this as a calculated column in your table.  That would be something like this.

Days = 
VAR _ThisDate = 'Item Ledger Entries'[Posting Date]
VAR _ProjStart = CALCULATE ( MIN ( 'Item Ledger Entries'[Posting Date] ), ALLEXCEPT ( 'Item Ledger Entries', 'Item Ledger Entries'[Project] ) )
RETURN
    DATEDIFF ( _ProjStart, _ThisDate, DAY )

jdbuchanan71_0-1617285617585.png

 

This worked beautifuly! Thank you so much!

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