Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey, everybody, how are you?
I'm facing a strange problem with query transformation in Power BI Desktop. I have a dataset where "column1" is a list of data (see image below):
When I expand "column1" it looks like it's a record list colum, with some null rows (see image below):
Therefore, I again apply an expansion, now in this column of records. So, it looks like everything worked well (see image below):
But... When I apply all transformations, Power BI displays this error:
It seems that few row records that were expanded did not match the expected structure. I've tried many transformations without success and searched the web, but I can't find a solution for this. Can someone help me?
Thank you!!!
Solved! Go to Solution.
Hi @pollyannaog
Can you share a mock pbix that reproduces the problem?
Looking at the error message it looks like PQ encounters a record where it expects a table. You could check if the item is a record with the following (it will yield true if it is a record):
Value.Is([YourColumnName], type record)
and then, if it is a record either ignore it in the expansion or perhaps convert it to table, depending on what you prefer.
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
I am not sure what the M code of the expansion step looks like without having similar data, but if it includes an each expression (per row transformation), you could wrap the existing each function in try <existing M> otherwise "Had An Error". That way you could refresh and see which rows are causing the error so you can investigate further.
Regards,
Pat
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
HI @pollyannaog,
Did you dataset table structure dynamic changes? AFAIK, power query will cache the previous processing table structure into query steps.
If some records data structure or stored data type changes so that they do not match with the cached data structure, power query will return an error message about the wrong type/structure transform.
Regards,
Xiaoxin Sheng
It does make sense, I hasn't think about it...thats why the error only happens when I apply the transformations.
Hi @pollyannaog
Can you share a mock pbix that reproduces the problem?
Looking at the error message it looks like PQ encounters a record where it expects a table. You could check if the item is a record with the following (it will yield true if it is a record):
Value.Is([YourColumnName], type record)
and then, if it is a record either ignore it in the expansion or perhaps convert it to table, depending on what you prefer.
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Thank you @AlB , with this trick I was able to create a custom column with the type of each row and then find out the one with different type!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
105 | |
77 | |
67 | |
63 |
User | Count |
---|---|
144 | |
107 | |
105 | |
82 | |
69 |