Forum Discussion
fgonzalez
5 years agoNew Member
PROBLEMS WHEN CREATING A NEW TABLE
I am occupying Power BI Desktop and creating a new table.
Take DAX, "Union" and "AllSelected" functions from an existing data table.
OC Tabla = (UNION
(ALLSELECTED(OC[Obra],OC[Numero OC2],OC[Proveedores],OC[Recurso 1],OC[Unidad 1],OC[Cant. 1],OC[Precio 1]),
ALLSELECTED(OC[Obra],OC[Numero OC2],OC[Proveedores],OC[Recurso 2],OC[Unidad 2],OC[Cant. 2],OC[Precio 2])))
(ALLSELECTED(OC[Obra],OC[Numero OC2],OC[Proveedores],OC[Recurso 1],OC[Unidad 1],OC[Cant. 1],OC[Precio 1]),
ALLSELECTED(OC[Obra],OC[Numero OC2],OC[Proveedores],OC[Recurso 2],OC[Unidad 2],OC[Cant. 2],OC[Precio 2])))
My problem is that adding the columns from the 2nd Table inverts the data from two columns.
I request help from the community.
Hi fgonzalez ,
Using below dax expression instead:
Table 2 = UNION ( SELECTCOLUMNS ( 'Table', "obra", 'Table'[Obra], "Numero OC2", 'Table'[Numero OC2], "Proveedores", 'Table'[Proveedores], "Recurso", 'Table'[Recurso 1], "Unidad", 'Table'[Unidad 1], "Cant", 'Table'[Cant.1], "Precio", 'Table'[Precio1] ), SELECTCOLUMNS ( 'Table', "obra", 'Table'[Obra], "Numero OC2", 'Table'[Numero OC2], "Proveedores", 'Table'[Proveedores], "Recurso", 'Table'[Recurso 2], "Unidad", 'Table'[Unidad 2], "Cant", 'Table'[Cant.2], "Precio", 'Table'[Precio 2] ) )And you will see:
For my sample .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
7 Replies
- fgonzalezNew Member
Any comment or advice.
- v-kelly-msft
Community Support
Hi fgonzalez ,
Do you mean that the column order isnt showing as you expected ?
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- fgonzalezNew Member