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
cyborgandy
Helper II
Helper II

Lookup Value with If

Hi All,

 

I have two tables, I am writing a calculated column in table 2 to get the information that if Closed Date of table 2 is greater than equal to the month column of table 1 in that case in the new calculated column it should give as "No" otherwise lookup value from table 2 to get the status of the company code.let me know if anyone can help

 

Table 1:

 

Company CodeCompany NameStatusClosed Date
1AVYes 
2VAYes15/11/2023
3RKYes 
4KRYes 
5ASYes15/11/2023

 Table 2:

Company CodeCompany NameSupplier NrSupplier NameMonthCalculated Coulmn
1AV111ABCNov-23 
2VA111ABCNov-23 
3RK111ABCNov-23 
4KR111ABCNov-23 
5AS111ABCOct-23 
1AV111ABCOct-23 
2VA111ABCOct-23 
3RK111ABCOct-23 
4KR111ABCOct-23 
5AS111ABCDec-23 
1AV111ABCDec-23 
2VA111ABCDec-23 
2VA111ABCOct-23 
2VA111ABCDec-23 
2VA111ABCDec-23 
3RK111ABCDec-23 
3RK111ABCAug-23 
3RK111ABCAug-23 
3RK111ABCAug-23 
5AS111ABCAug-23 
5AS111ABCAug-23 
5AS111ABCDec-23 
5AS111ABCDec-23 
5AS111ABCAug-23 
5AS111ABCNov-23 
2VA111ABCSep-23 
2VA111ABCSep-23 
1 ACCEPTED SOLUTION
v-zhouwen-msft
Community Support
Community Support

Hi @cyborgandy ,

The table data is shown below:

vzhouwenmsft_0-1707964122671.png

vzhouwenmsft_1-1707964135653.png

Please follow these steps:

1. Use the following DAX expression to create a column

Column = IF(ISBLANK(LOOKUPVALUE(Table1[Closed Date],Table1[Company Code],'Table2'[Company Code])),
"YES",
IF(MONTH(LOOKUPVALUE('Table1'[Closed Date],'Table1'[Company Code],'Table2'[Company Code]))>MONTH('Table2'[Month]) ,
"NO",
"YES"))

2. Final output

vzhouwenmsft_2-1707964223346.png

 

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-zhouwen-msft
Community Support
Community Support

Hi @cyborgandy ,

The table data is shown below:

vzhouwenmsft_0-1707964122671.png

vzhouwenmsft_1-1707964135653.png

Please follow these steps:

1. Use the following DAX expression to create a column

Column = IF(ISBLANK(LOOKUPVALUE(Table1[Closed Date],Table1[Company Code],'Table2'[Company Code])),
"YES",
IF(MONTH(LOOKUPVALUE('Table1'[Closed Date],'Table1'[Company Code],'Table2'[Company Code]))>MONTH('Table2'[Month]) ,
"NO",
"YES"))

2. Final output

vzhouwenmsft_2-1707964223346.png

 

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.