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
smpa01
Super User
Super User

Alternative of NATURALLEFTOUTERJOIN on a temp table (DAX Query)

Is there any alternative of NATURALLEFTOUTERJOIN on a temp table ... if yes, want to test out the performnce imapct with the alternative.  ANy help is appreciated !!!

 

LOOKUPVALUE won't work on a temp table.

 

E.g. Query

 

 

Table = 
    VAR _1 = DATATABLE (
        "ID", STRING,
        "BU", STRING,
        "YEAR", INTEGER,
        "Month", INTEGER,
        {
            { "BU1-2019-1", "BU-1", 2019, 1 },
            { "BU1-2019-2", "BU-1", 2019, 2 },
            { "BU1-2019-3", "BU-1", 2019, 3 }
        }
    )
VAR _2 = DATATABLE (
        "ID", STRING,
        "Actual", INTEGER,
        {
            { "BU1-2019-1", 100 },
            { "BU1-2019-2", 200 },
            { "BU1-2019-3", 300 }
        }
    )
VAR _3 = NATURALLEFTOUTERJOIN(_1,_2)
RETURN _3

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 REPLY 1
v-diye-msft
Community Support
Community Support

Hi @smpa01 

 

Kindly check below one:

Table 3 = 
VAR _1 =
    DATATABLE (
        "ID", STRING,
        "BU", STRING,
        "YEAR", INTEGER,
        "Month", INTEGER,
        {
            { "BU1-2019-1", "BU-1", 2019, 1 },
            { "BU1-2019-2", "BU-1", 2019, 2 },
            { "BU1-2019-3", "BU-1", 2019, 3 }
        }
    )
VAR _2 =
    DATATABLE (
        "ID", STRING,
        "Actual", INTEGER,
        {
            { "BU1-2019-1", 100 },
            { "BU1-2019-2", 200 },
            { "BU1-2019-3", 300 }
        }
    )
VAR _3 =
    SELECTCOLUMNS ( _2, "ID", [ID] )
RETURN
    ADDCOLUMNS (
        FILTER ( _1, [ID] IN _3 ),
        "Actual", VAR i = [ID] RETURN SUMX ( FILTER ( _2, [ID] = i ), [Actual] )
    )

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

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.