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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Casey_ONeal
Frequent Visitor

Need some assistance with DAX

Hi, I am somewhat new to Power BI and I could use some assistance with a calculation I need to do. Basically, I have two related tables let's call them Table 1 and Table 2. I need to calculate whether or not a date is less than or equal to another date if they are then return good if not then return overdue. Date1 <= Date2, Good, Overdue something along these lines.
1 ACCEPTED SOLUTION

OK, and the date fields are in one table each?

In this case, you could e.g. create a calculated column in Table1 with:
= IF(Table1[Date1] <= RELATED(Table2[Date2]), "Good", "Overdue")

View solution in original post

4 REPLIES 4
Michiel
Resolver III
Resolver III

 You'll need to provide some more details here. Your two tables are related, you say? Meaning there's a relationship between the two in the Power BI model? If so, on what fields? And if not, how would Power BI know which two dates to compare? There can be many in each table.

Yes, there is a 1:1 relationship in the Power BI model based on a field containing component names/codes which are unique identifiers.

OK, and the date fields are in one table each?

In this case, you could e.g. create a calculated column in Table1 with:
= IF(Table1[Date1] <= RELATED(Table2[Date2]), "Good", "Overdue")

Michiel, Thank you for the assistance here. Follow up question for anyone. Can you do the same thing with tables that have an indirect relationship?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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