Forum Discussion
DAX UNION does not work as expected
- 5 years ago
Hi Anonymous thank you very much for your suggection. It was sorted. UNION did not work for me so I found the example in internet and it solved my problem
instead of using just Union (table1, table2,table3, table4)
I used Union(table21, table2,table3, SELECTCOLUMNS ( Table4, "Column1", Table4[Column1], "Column2", Table4[Column2], "Column3", Table4[Column3] ) and it works!!!!
)
liudmila , can share how you created table4. if possible some sample data to create the same.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- liudmila5 years agoFrequent Visitor
It works perfectly in my example.
This is my example:
https://drive.google.com/file/d/1TAVWiVqS22K16hPGvk-o86aY-JrvUp6k/view?usp=sharing
- Anonymous5 years agoNot applicable
Hi liudmila ,
Please update the formula of calculated table AllDays_Tax as below:
AllDays_Tax = VAR A = SELECTCOLUMNS ( Flowers, "Month_Year", Flowers[Date].[Month] & Flowers[Date].[Year], "Date", Flowers[Date], "Value", BLANK () ) VAR B = SELECTCOLUMNS ( Tax, "Month_Year", Tax[Date].[Month] & Tax[Date].[Year], "Date", BLANK (), "Value", Tax[Value] ) VAR Result = DISTINCT ( UNION ( FILTER ( A, NOT ( ISBLANK ( [Date] ) ) ), B ) ) RETURN ResultIf the above one is not working, could you please tell me what's your final expected result with the backend logic and function? I want to check whether we can achieve it only by creating measures or calculated columns... Thank you.
Best Regards
- liudmila5 years agoFrequent Visitor
Hi Anonymous thank you very much for your suggection. It was sorted. UNION did not work for me so I found the example in internet and it solved my problem
instead of using just Union (table1, table2,table3, table4)
I used Union(table21, table2,table3, SELECTCOLUMNS ( Table4, "Column1", Table4[Column1], "Column2", Table4[Column2], "Column3", Table4[Column3] ) and it works!!!!
)