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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
21818
Frequent Visitor

Calculate column according to a different date table

Hi! 

 

I would like to compare a date field from a table with a general date table that I am using as a slicer to filter data. Data table looks like this: 

 

Report       Due Date         Overdue (Y/N)

#1            10/10/2019      

#2            15/10/2019

 

So for example, if I select a data range in the slicer before 10/10/2019, "Overdue" column should be "N" for both reports. 

If, data range ends between 10th and 15th Oct, #1 should be in overdue.

And finally if data range ends after 15th Oct, both reports should be ticked as "Overdue".

 

I have created the following formula after creating a relationship between tables, but it is not working as expected.

Overdue = IF('Table1'[Due Date]>RELATED(DateTable[Date]),"Overdue","on time")

 

Any help will be much appreciated! 

 

Thank you in advance. 

2 ACCEPTED SOLUTIONS
jthomson
Solution Sage
Solution Sage

Try pulling through the largest value in your date table as a variable and then compare your due date column to that?

View solution in original post

lc_finance
Solution Sage
Solution Sage

Hi @21818 ,

 

 

As @jthomson mentioned, the solution is to compare the maximum value of your slicer to the due date in your table.

Here is the formula you can use:

Overdue = 
VAR dueDate = SELECTEDVALUE('Table'[Due date])


RETURN
IF(MAX('Dates'[Date])<dueDate,"N","Overdue")

And a screenshot showing the end result

 

Screenshot 2019-10-13 at 12.08.02 PM.png

Regards,

 

LC

Interested in Power BI finance templates? Check out my blog at www.finance-bi.com

View solution in original post

4 REPLIES 4
lc_finance
Solution Sage
Solution Sage

Hi @21818 ,

 

 

As @jthomson mentioned, the solution is to compare the maximum value of your slicer to the due date in your table.

Here is the formula you can use:

Overdue = 
VAR dueDate = SELECTEDVALUE('Table'[Due date])


RETURN
IF(MAX('Dates'[Date])<dueDate,"N","Overdue")

And a screenshot showing the end result

 

Screenshot 2019-10-13 at 12.08.02 PM.png

Regards,

 

LC

Interested in Power BI finance templates? Check out my blog at www.finance-bi.com

Hi @lc_finance  and @jthomson ,

 

I managed to solve this using your suggestions. 

 

Many thanks for your help.

glad to hear you found a solution.

 

Let us know if you need more help,

 

LC

jthomson
Solution Sage
Solution Sage

Try pulling through the largest value in your date table as a variable and then compare your due date column to that?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.