Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.