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
SonaSinghA
Helper III
Helper III

DAX help for Vlookup


HI Experts,

Can I create a vlookup formula using dax based on below conditons
I have a table with ID and Reporting date
And another table with same ID, Status. Raised date and Closure date .

I need to add Status in the first table baed on below two conditions

if Reporting date  >= Raised date  &&
   Reporting date  <= Closure date then I need to show staus.

Please help

1 ACCEPTED SOLUTION

 

@SonaSinghA 

pls try this

 

Column = maxx(FILTER('Table (2)','Table (2)'[ID]='Table'[ID]&&'Table'[Reporting date]>='Table (2)'[Raised date]&&'Table'[Reporting date]<='Table (2)'[Closure date]),'Table (2)'[Status])

 

 

11.PNG

 the date of 100 does not between the raised date and closure date. So shall we display blank?

 

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

pls provide some sample data





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Project IDReporting dateStatus  
10001-01-2023Yes  
10004-01-2023   
10101-01-2023No  
10104-01-2023   
     
     
     
Project IDRaised dateClosure dateStatus 
10001-01-202315-01-2023Yes 
10110-01-202215-01-2022No 
10101-01-202303-01-2023No 

 

@ryan_mayu , please check

Hi,

In Table1, write this calculated column formula

Status = CALCULATE(MAX(Table2[Status]),FILTER(Table2,Table2[ID]=EARLIER(Table1[ID])&&Table2[Raised date]>=EARLIER(Table1[Reporting date])&&Table2[Raised date]<=EARLIER(Table1[Reporting date])))

Hope this helps.

Ashish_Mathur_0-1703127593115.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

 

@SonaSinghA 

pls try this

 

Column = maxx(FILTER('Table (2)','Table (2)'[ID]='Table'[ID]&&'Table'[Reporting date]>='Table (2)'[Raised date]&&'Table'[Reporting date]<='Table (2)'[Closure date]),'Table (2)'[Status])

 

 

11.PNG

 the date of 100 does not between the raised date and closure date. So shall we display blank?

 

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu , we cant use one to many relationship here, same id's will repeate in the second table with different raised date. 

still not clear about this. 100's reporint date does not match 

Reporting date  >= Raised date  &&   Reporting date  <= Closure date 

so that's why it returns blank.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu , Sorry, it was my mistake. Still, I can't use one-to-many relationships because Project IDs will repeat every month for new issues

.

we don't need to create the relationships between two tables

you can delete the relationship and have a try

11.PNG12.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.