Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
-- create two tables and join together
DEFINE
TABLE AllTable = DATATABLE ( "Column Name", STRING, {{"All"}} )
TABLE SummaryTable = DATATABLE ( "Column Name", STRING, {{"Yes"}} )
--TABLE UnionTable = UNION ( AllTable, SummaryTable ) -- 1
TABLE UnionTable = UNION ( row ("Column Name", "All" ), SummaryTable ) -- 2
EVALUATE
UnionTable
--SummaryTable
--AllTable
Trying to sandwich a literal table with an existing table. ie add a row to a single column table.
In dax studio getting the error "Failed to resolve name 'SummaryTable'. It is not a valid table, variable or function name".
Yet SummaryTable as the return value will give the "Yes" result without error. --2 is another attempt and giving the same error result.
What am I missunderstanding with dax here?
Solved! Go to Solution.
@garythomannCoGC , Try like
DEFINE
var AllTable = DATATABLE ( "Column Name", STRING, {{"All"}} )
var SummaryTable = DATATABLE ( "Column Name", STRING, {{"Yes"}} )
--var UnionTable = UNION ( AllTable, SummaryTable ) -- 1
var UnionTable = UNION ( row ("Column Name", "All" ), SummaryTable ) -- 2
EVALUATE
UnionTable
--SummaryTable
--AllTable
@amitchandak Thank you for your reply. Works for both UnionTable scenarios. Doh, I had started with VAR's then got the error then switched to TABLE usage thinking the code needed tightening ie dealing only with tables.
Just had a play and when the UnionTable line is declared as TABLE we get the error.
Oh boy that does not make sense! Why does the declaration of UnionTable need to be VAR and bombs with TABLE!?
And which would you choose for the initial declarations? VAR just seems too loose 🙂
Lol and which would you pick and why for the UNION statement? I'm thinking --1 as this looks more straightforward (maybe more SQL-ish :))
@garythomannCoGC , Try like
DEFINE
var AllTable = DATATABLE ( "Column Name", STRING, {{"All"}} )
var SummaryTable = DATATABLE ( "Column Name", STRING, {{"Yes"}} )
--var UnionTable = UNION ( AllTable, SummaryTable ) -- 1
var UnionTable = UNION ( row ("Column Name", "All" ), SummaryTable ) -- 2
EVALUATE
UnionTable
--SummaryTable
--AllTable
User | Count |
---|---|
42 | |
26 | |
21 | |
16 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
17 | |
15 |