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
gigotomo
Frequent Visitor

Lookup for dates

I have 2 tables , Table1and Table2.

I require to check whether Table2[Date] exists in Table1 and in case it does then Table2[type] should be Red or else Green.

Capture.JPGCapture1.JPG

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @gigotomo 

According to your requirement, I think you can achieve this using DAX to create a calculated column in the Table 2 like this:

Type =

IF(

    [Date] in SELECTCOLUMNS('Table 1',"1",[Date]),

    "Red","Green")

 

And you can get what you want, like this:

v-robertq-msft_0-1617615626532.png

 

You can download my test pbix file here

More info about SelectColumns() function in DAX

 

Best Regards,

Community Support Team _Robert Qin

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

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, @gigotomo 

According to your requirement, I think you can achieve this using DAX to create a calculated column in the Table 2 like this:

Type =

IF(

    [Date] in SELECTCOLUMNS('Table 1',"1",[Date]),

    "Red","Green")

 

And you can get what you want, like this:

v-robertq-msft_0-1617615626532.png

 

You can download my test pbix file here

More info about SelectColumns() function in DAX

 

Best Regards,

Community Support Team _Robert Qin

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

PC2790
Community Champion
Community Champion

Hello @gigotomo ,

 

Create a new column with the following DAX:

Flag = If(NOT(ISBLANK(LOOKUPVALUE(Table1[Date],Table1[Date],Table2[Date]))),"Red","Green")
amitchandak
Super User
Super User

@gigotomo ,


New column in Table 2 =
var _1 = countx(filter(Table1,Table1[Date] =Table2[Date]), Table1[Date])
return
if(isblank(_1), false(), true())

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.