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
Anonymous
Not applicable

Calculated column on a table based on two columns from a different table

Hi Gurus, 

 

I have  requrirment that I struggel,

 

I have two tabels (Table 1 and table 2) I want a new calculated column in tabel 2.

 

logic is as below

 

if ColA and ColB (Tabel1) matches with Col1 and Col2 (Tabel2)   new column should say "Scheduel" if not it should say "New"

 

Below is a image of the tabels 

 

Newcolumn.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak , 

 

it works, thanks a lot chapm. 

 

would you be able to explain the DAX machnics behind it. why would you use COUNTX, I thouugh it could get done with a LOOKUPVALUE function mearging with AND. (I tried it and failed).

 

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in Table2

=if(calculate(countrows(table2),filter(table1,table1[ColA]=earlier(table2[Col1])&&table1[ColB]=earlier(table2[Col2])))>0,"Schedule","New")

Hope this helps.

 


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

It does  not work

@Anonymous , New column in Table 2

new column =
Var _1 = countx(filter(Table1,Table1[ColA]=Table2[Col1] && Table1[ColB]=Table2[Col2]),[Table2[Col2]])
return if(isblank(_1) , "New","Scheduled")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak , 

 

it works, thanks a lot chapm. 

 

would you be able to explain the DAX machnics behind it. why would you use COUNTX, I thouugh it could get done with a LOOKUPVALUE function mearging with AND. (I tried it and failed).

 

 

@Anonymous , LOOKUPVALUE  shhould also work. But if there more then one values returned you need to handle that. In that one X function is bascially enfocing aggregation. So you will get one value. 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

Share the link from where i can download your PBI file.


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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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