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
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

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
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.

Top Solution Authors