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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
carinalou
Advocate I
Advocate I

Create measure that returns "in N days" or "N days ago" using inactive relationship to date table

I am trying to create a table visual that shows upcoming due dates of trainings assigned to employees.

 

My fact table of trainings assigned looks like this:

TrainingEmployeeAssigned DateDue DateStart DateCompleted Date
Training 1Employee A

10/1/202

3

10/31/202310/3/202310/3/2023
Training 1Employee B10/1/202310/31/202310/7/202310/12/2023
Training 1Employee C10/1/202310/31/202310/31/2023 
Training 2Employee A10/15/202311/14/202310/16/202310/17/2023
Training 2Employee B10/15/202311/14/202310/19/2023 
Training 2Employee C10/15/202311/14/2023  
Training 3Employee A11/1/202311/30/202311/2/2023 
Training 3Employee B11/1/202311/30/2023  
Training 3Employee C11/1/202311/30/2023  

 

All 4 date fields have a relationship to the date table, with Assigned Date being the active one. Here is the date table:

DateDays From Today
10/1/202338
10/2/202337
10/3/202336
10/4/202335
10/5/202334
10/6/202333
10/7/202332
10/8/202331
10/9/202330
10/10/202329

 

I want to create a table visual that looks like this:

DueTraining% Complete
8 days agoTraining 167%
in 7 daysTraining 233%
in 22 daysTraining 30%

 

How can I write a DAX measure to use the inactive relationship between Due Date and the date table, and return "N days ago" for the past and "in N days" for the future? Thanks in advance!

1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @carinalou,

If it is a mandatory thing to use the inactive relationship and the column "Days From Today" then I'd enable filtering in both directions for this inactive relationship and use the measure below.

barritown_0-1699721455688.png

Otherwise, I'd do the same with only the Fact table and DAX TODAY() function.

Please check the attached file for more details.

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

2 REPLIES 2
barritown
Super User
Super User

Hi @carinalou,

If it is a mandatory thing to use the inactive relationship and the column "Days From Today" then I'd enable filtering in both directions for this inactive relationship and use the measure below.

barritown_0-1699721455688.png

Otherwise, I'd do the same with only the Fact table and DAX TODAY() function.

Please check the attached file for more details.

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Thanks for your help!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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