Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello all,
I'm currently grappling with an issue related to a DAX query, and I'm reaching out to seek your expertise in resolving it. Whenever I attempt to execute a DAX query with a UNION, I encounter an error message that states "Mismatched Number of Columns." I'm at a bit of a loss as to where I might be making a mistake, so I'm hoping for some valuable guidance and insights from this community.
Description:
I'm in a situation where I'm trying to amalgamate data from multiple tables using a DAX query that includes a UNION operation. The goal here is to create a unified result set, combining data from these different tables. However, it appears that my DAX query is faltering due to an expectation of the same number of columns in all the SELECT statements within the UNION.
I've rigorously reviewed the structure of my tables and the individual SELECT statements, and everything seems to be in order. Despite my efforts, the error persists.
attached below are the screenshot of my query.
Solved! Go to Solution.
ADDCOLUMNS returns a table. These 2 columns : source and count, get added to each of the tables: vw_booking_ref and vw_request.
Then there is an attempt to UNION the 2 tables.That means the whole of each table not just the 2 columns mentioned
The two tables must have the same number of columns.
Columns are combined by position in their respective tables.
Does that help?
Hello, Sir @HotChilli @. I wanted to express my gratitude for your valuable feedback.
I made some adjustments to my query to achieve the desired result
ADDCOLUMNS returns a table. These 2 columns : source and count, get added to each of the tables: vw_booking_ref and vw_request.
Then there is an attempt to UNION the 2 tables.That means the whole of each table not just the 2 columns mentioned
The two tables must have the same number of columns.
Columns are combined by position in their respective tables.
Does that help?
Hello, Sir @HotChilli @. I wanted to express my gratitude for your valuable feedback.
I made some adjustments to my query to achieve the desired result
Good day, @HotChilli. I appreciate your time and assistance
I apologize for any prior lack of information. I'd like to provide you with the table structure for both 'vw_request' and 'vw_booking_ref':
Additionally, I have a question regarding the difference in the number of columns between these two tables. As I mentioned in my previous post, I shared the query for the union, where I selected only two columns for both queries. Does this difference in column count matter? Your insights on this would be greatly appreciated.
What is the structure of the 2 source tables? vw_booking_ref and vw_request
--
There might still be a problem but we don't have enough info here
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |