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
dhanyasyam
New Member

Date difference between a date column in a table and a dynamic custom date :

I have a table with a date column Invoice Table (Invoice Id, Invoice Date, Invoice amount)...I need a new custom date attribute (say 'Effective Date') which will take input from the filter selection by user . Now I need to find the' Invoice_Age' . Which is the difference of Invoice Date from each record and Effective Date input. I am using Direct Query in Power Bi desktop. 
Please suggest me right way to achieve this. 


Details Updated:-
Invoice Table 

dhanyasyam_0-1683781159173.png


I need to create a date attribute called 'Effective Date' that can take single date input from user from filter panel and use that date to calculate 'Invoice Age' and create a report as below. Also I need to use this Invoice Age to create some group bins .
If Effective Date selected by user from filter :  01-02-2023

dhanyasyam_1-1683781238987.png

Please suggest a solution for this complete requirement @Mahesh0016 






2 REPLIES 2
Mahesh0016
Super User
Super User

@dhanyasyam Please reffer below code

Days =
CALCULATE (
[Sum Of Sale],
FILTER (
ALL ( 'Table Y'[Date] ),
DATEDIFF ( 'Table Y'[Date], MAX ( 'Table Y'[Effective Date] ), DAY ) < 31
&& DATEDIFF ( 'Table Y'[Date], MAX ( 'Table Y'[Effective Date] ), DAY ) >= 0
)
)


@dhanyasyam If this post helps you please mark as solutions and give the Thump/kudos.THANK YOU!!

Mahesh0016
Super User
Super User

@dhanyasyam Please Share Demo Dataset and Expected Output in Table.

THANK YOU!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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