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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ktran22
Regular Visitor

Comparing Date Fields in PowerBI

I wanted to create a new column in my PowerBI Dashboard report that compares two date columns (<, >, >=, <=). I need the output for this new date column to either be a date or some sort of binary output (true/fasle, 1 or 0). How can I do this in a PowerBI?

14 REPLIES 14
ktran22
Regular Visitor

@DOLEARY85 It did not work. Please see below screenshotScreenshot 2023-04-10 at 1.40.37 PM.png

Do you have a copy of the PBIX file i could look at?

@DOLEARY85 Here is a screenshot of the tables. I can't share the PBIX file. Screenshot 2023-04-10 at 3.15.16 PM.png

 

Okay without seeing the data it might be more difficult, from the look of it each record in the aprroval table links to many in the security. which date are you trying to compare against?

 

if it's the most recent, try wrapping the knowledge date part in a MAX function.

 

Column = if('Table'[Column1]=MAX('Table'[Column2]),1,0)

@DOLEARY85 Does it matter which table I create the calculated column on? See attached. There  can be many different knowledge dates but the approval date is only the most recent shown in that column. Both Approval and Security tables are connected on the Security IDScreenshot 2023-04-10 at 4.11.41 PM.png

It should work if you put it in the security table, i took a sample of the data and ran a test:

 

Column = if(Security[Knowledge Date] < max(Approval[Approval Date]),1,0)
 
DOLEARY85_0-1681159096447.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Even in this example the knowledge date is prior to the approval date but yet the formula you wrote is returning a 1

IT WORKED! Thank you

@DOLEARY85 Never mind. I am still getting values that are returning true even though the knowledge date of that row is less than the MAX(Approval Date). This is the formula I inputed: 

Approval Check = IF(MAX(Approval[Approval Date]) >= Security[Knowledge Date],1,0). See screenshot below. 
Screenshot 2023-04-10 at 5.09.41 PM.png

 

Check the dates are the same format in both tables

What format should they be in? Date, true/false, text? 

No Problem, happy to help 🙂

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

To reiterate, there is only one Approval Date per Security ID but there can be multiple Knowledge Dates per Security ID

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you can create a calculated column:

 

e.g. for if one is equal to the other:  

Column = if('Table'[Column1]='Table'[Column2],1,0)
 
DOLEARY85_0-1681148062320.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors