Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have two tables, Table 1 and Table 2, both are related based on account number.
I want to compare if date from table 1 = date from table 2, if is not the same then "different" is it is the same then "equal". How can I do an if statement, comparing both dates row by row so I can add it to table.
You may be able to use the LOOKUPVALUE function in this case.
As an example I have two tables
Table 1
Date | Account |
3/3/2024 | ABC |
3/3/2024 | DEF |
3/4/2024 | ABC |
3/5/2024 | GHI |
3/5/2024 | DEF |
and Table 2
Date | Account |
3/3/2024 | ABC |
3/4/2024 | DEF |
3/5/2024 | GHI |
and I want to know if the values in Table 1 appear in Table 2.
I can add a calculated column to Table 1 with the following code...
isOnTable2 =
var _lookup =
LOOKUPVALUE('Table 2'[Account], 'Table 2'[Account], [Account], 'Table 2'[Date], [Date])
Return
IF(
_lookup = [Account],
"Yes",
"No"
)
and end up with the result...
Hope this gets you pointed in the right direction.
Proud to be a Super User! | |
Hi, is not working, see the following example I am getting
If you can provide a sample of your data (nothing sensitive) I will likely be able to provide a better solution for you.
Proud to be a Super User! | |
I can't share the data
Table 1:
Account & Date
Table 2:
Account & Date
Relationship: Account & Account
The column that I am creating is in the Table 1, and there are more columns. I created a table with more columns ej. Name, Second Name, Account, Date table 1, date table 2
Hi,
Share some dummy data and show the expected result.
TABLE 1 | TABLE 2 | RESULT | ||||
Account | Date | Account | Date | Result | ||
765A | 1/1/2022 | 765A | 11/12/2023 | FALSE | ||
987D | 5/7/2023 | 987D | 4/5/2023 | FALSE | ||
036G | 9/2/2023 | 036G | 9/2/2023 | TRUE | ||
872B | 9/9/2023 | 872B | 9/9/2023 | TRUE | ||
926K | 4/5/2023 | 926K | 1/1/2022 | FALSE | ||
047A | 6/1/2023 | 047A | 6/1/2023 | TRUE | ||
102M | 2/3/2023 | 102M | 2/3/2023 | TRUE | ||
094K | 7/8/2022 | 094K | 9/9/2023 | FALSE | ||
237V | 5/7/2023 | 237V | 12/5/2023 | FALSE |
Hi,
In Table1, write this calculated column formula
Column = if(CALCULATE(min(Table2[Date]),FILTER(Table2,Table2[Account]=EARLIER(Table1[Account])))=Table1[Date],"Same","Different")
Hope this helps.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
68 | |
53 | |
39 | |
33 |
User | Count |
---|---|
70 | |
63 | |
57 | |
49 | |
46 |