NATURALINNERJOIN DAX Function (Table manipulation)

Joins the Left table with right table using the Inner Join semantics.

Syntax

NATURALINNERJOIN ( <LeftTable>, <RightTable> )
Parameter Attributes Description
LeftTable

The Left-side table expression to be used for join.

RightTable

The Right-side table expression to be used for join.

Return values

Table An entire table or a table with one or more columns.

A table which includes only rows for which the values in the common columns specified are present in both tables. The table returned will have the common columns from the left table and other columns from both the tables.

Remarks

There is no sort order guarantee for the results.
Columns being joined must have the same data type and the same name in both tables.
The columns considered for the join are those of the expanded table, not just the base table: two tables can be joined through common columns in related tables.
The columns used in the join condition that correspond to physical columns of the data model must also have the same data lineage; two columns with the same name and different data lineage generate an error.
Two columns with the same data lineage must have also the same full column name, which includes both table name and column name; otherwise, they are not matched for the join.
Strict comparison semantics are used during the join. There is no type coercion; for example, 1 does not equal 1.0.

» 5 related articles

Examples

--  NATURALLEFTOUTERJOIN performs a left outer join between two
--  tables, joining columns with the same name. 
--  NATURALINNERJOIN performs an inner join.
--  Corresponding columns must both have the same lineage, or no lineage.
DEFINE
    VAR StoresByCountry = 
        SELECTCOLUMNS (
            TREATAS ( { "Armenia", "Australia", "Denmark" }, Store[CountryRegion] ),
            "Country", Store[CountryRegion] & "",
            "NumOfStores", CALCULATE ( COUNTROWS ( Store ) )
        )
    VAR CustomersByCountry = 
        SELECTCOLUMNS (
            TREATAS ( { "Armenia", "Australia", "Denmark" }, Customer[CountryRegion] ),
            "Country", Customer[CountryRegion] & "",
            "NumOfCustomer", CALCULATE ( COUNTROWS ( Customer ) )
        )
        
EVALUATE StoresByCountry

EVALUATE CustomersByCountry

EVALUATE
    NATURALLEFTOUTERJOIN ( StoresByCountry, CustomersByCountry )
    
EVALUATE
    NATURALLEFTOUTERJOIN ( CustomersByCountry, StoresByCountry )
    
EVALUATE
    NATURALINNERJOIN ( StoresByCountry, CustomersByCountry )

Country NumOfStores
Armenia 1
Australia 3
Denmark 1
Country NumOfCustomer
Armenia 1
Australia 3,631
Country NumOfStores NumOfCustomer
Armenia 1 1
Australia 3 3,631
Denmark 1 (Blank)
Country NumOfCustomer NumOfStores
Armenia 1 1
Australia 3,631 3
Country NumOfStores NumOfCustomer
Armenia 1 1
Australia 3 3,631

Related articles

Learn more about NATURALINNERJOIN in the following articles:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/naturalinnerjoin-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of NATURALINNERJOIN? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.