Forum Discussion
Corlin
8 years agoFrequent Visitor
Field mismatch when using UNION
I am trying to combine two tables, but when I try to union them I get a mismatch between the fields as seen below. The goal is to create a table that contains all dates and filling the empty fields ...
- 8 years ago
Hi Corlin
You may have a look at UNION Function. To get the table as requested, the first way is to make sure the 'Date' column in WFOpenClosed table is the first column as below. Then you may get the table with your code.
The second way is to change the code like below to get the table as requested.
WFOpenClosedZeroFilled = UNION ( SELECTCOLUMNS ( WFOpenClosed, "date", WFOpenClosed[date], "Closed", WFOpenClosed[Closed], "WorkflowID", WFOpenClosed[WorkflowID], "Open", WFOpenClosed[Open] ), ADDCOLUMNS ( EXCEPT ( VALUES ( 'calendar'[Date] ), VALUES ( WFOpenClosed[Date] ) ), "Closed", 0, "Open", 0, "WorkflowID", 0 ) )Regards,
Cherie
v-cherch-msft
Microsoft Employee
8 years agoHi Corlin
You may have a look at UNION Function. To get the table as requested, the first way is to make sure the 'Date' column in WFOpenClosed table is the first column as below. Then you may get the table with your code.
The second way is to change the code like below to get the table as requested.
WFOpenClosedZeroFilled =
UNION (
SELECTCOLUMNS (
WFOpenClosed,
"date", WFOpenClosed[date],
"Closed", WFOpenClosed[Closed],
"WorkflowID", WFOpenClosed[WorkflowID],
"Open", WFOpenClosed[Open]
),
ADDCOLUMNS (
EXCEPT ( VALUES ( 'calendar'[Date] ), VALUES ( WFOpenClosed[Date] ) ),
"Closed", 0,
"Open", 0,
"WorkflowID", 0
)
)Regards,
Cherie
Corlin
8 years agoFrequent Visitor
Thank you for your input, I ended up using the SELECTCOLUMN to solve my problem.