Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am creating a table with DAX, which is essentially joining two different tables. Sorry for the bit of a wall of DAX, but here is what I am using for reference:
Joined Table =
VAR Table1 =
GENERATE(
VALUES('Fact_Table_1'[Year-Month]),
UNION (
ADDCOLUMNS (
Column,
"Result 1", [Measure 1] - (CALCULATE([Measure 1], DATEADD(Fact_Table_1[Year-Month], -1, YEAR))),
"Calculation Type", "LY",
"Key", FORMAT (Fact_Table_1[Year-Month], "yyyymmdd" & "LY")
),
ADDCOLUMNS (
Column',
"Result 1", [Measure 1] - (CALCULATE([Measure 1], DATEADD(Fact_Table_1[Year-Month], -1, QUARTER))),
"Calculation Type", "LQ",
"Key", FORMAT (Fact_Table_1[Year-Month], "yyyymmdd" & "LQ")
),
ADDCOLUMNS (
Column,
"Result 1", [Measure 1] - (CALCULATE([Measure 1], DATEADD(Fact_Table_1[Year-Month], -1, MONTH))),
"Calculation Type", "LM",
"Key", FORMAT (Fact_Table_1[Year-Month], "yyyymmdd" & "LM")
)
)
)
VAR Table2 =
GENERATE(
DISTINCT(Fact_Table_2[Date]),
UNION (
ADDCOLUMNS (
Column,
"Result 2", [Measure 2] - (CALCULATE([Measure 2], DATEADD(Fact_Table_2[Date], -1, YEAR))),
"Calculation Type", "LY",
"Key", FORMAT (Fact_Table_2[Date], "yyyymmdd" & "LY")
),
ADDCOLUMNS (
Column,
"Result 2", [Measure 2] - (CALCULATE([Measure 2], DATEADD(Fact_Table_2[Date], -1, QUARTER))),
"Calculation Type", "LQ",
"Key", FORMAT (Fact_Table_2[Date], "yyyymmdd" & "LQ")
),
ADDCOLUMNS (
Column,
"Result 2", [Measure 2] - (CALCULATE([Measure 2], DATEADD(Fact_Table_2[Date], -1, MONTH))),
"Calculation Type", "LM",
"Key", FORMAT (Fact_Table_2[Date], "yyyymmdd" & "LM")
)
)
)
RETURN
NATURALINNERJOIN (
Table1, Table2
)
This returns my expected result, but the join function throws an error when the date columns of each fact table has the same name. As such, I had to rename one of my date columns for this to work. So my end result is a table with two identical date columns, like this example below:
Within my DAX expression, I need to refer to the date column within the relative fact table to get the correct result for the time intelligence calculations. However, it is unnecessary to include two identical date columns in the same table.
I feel like I must be missing something simple.
Is there a way I can modify my DAX to only return one date column? Or at the very least drop one of the date columns?
Solved! Go to Solution.
@markmess77 - Use SELECTCOLUMNS to overcome name duplicates.
@markmess77 - Use SELECTCOLUMNS to overcome name duplicates.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.