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

In calculated column , how to replace Lookupvalue with Related and create SQL script

Hi All

I have 2 tables : Table 1 and Table 2 , (1 --> M relation)

In Table 1: I am creating the  following calculated column:

Nazdac911_0-1668243602242.png

 

 

TableA[Col Z] =

LOOKUPVALUE(

        TableB[Col X] , Table[B] [Col Y], "String_Value",

        TableA[Col PK] , TableB[Col SK] , 

        "N/A")

 

This line work great .

I need help for 2 things:

  • I want to use Related instead of lookup
  • How could I create the equivalent SQL script for this DAX script?

Thanks in advance  

2 REPLIES 2
amitchandak
Super User
Super User

@Nazdac911 , A new column in Table A

 

Coalesce(maxx(filter(Table2, Table[2] = "Value"), Table2[X]) , 0)

 

or

 

Coalesce(sumx(filter(Table2, Table[2] = "Value"), Table2[X]) , 0)

 

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

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 

Thank you for the fast reply .. 

I will need to digest the coalsec function , i never work with it before .. 

but unfortunality it did not work and gave me the follwoing error message 

Nazdac911_0-1668243833159.png

I updated my lookupvalue function and added the Value is a string value ( all relative columns are string columns) 

Thank you for sharng the youtube videios , they are of great value 

Regarda 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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