Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello,
I have an Excel file linked to my .xml. files. The files is generated by an external system two or three times a day with a .cmd file and opens the Excel report automatically. Some columns have table data which I expand. My issue is that I have two columns that have numeric or text data in the morning and table data later in the day. If I don't expand it I get [table] results at some point, and If I do expand the columns I received an error message. I have tried with a few if statement but I'm new with M and could not manage anything. Is there a way to dectec the data type and expand if necessary ?
Many thanks !
Solved! Go to Solution.
Hi @Gilgam
Yes you can check the data type like this
if [Files] is table then "Table" else if [Files] is list then "List" else if [Files] is record then "Record" else null
In your case you can check for a table and then expand it like this
if [Files] is table then Table.ExpandTableColumn() "Table" else [Files]
I can't fill in the arguments for the Table.ExpandTableColumn function as I don't know the structure of your data, you will need to do that. Or post back here with sample data so I can help with it.
Regards
Phil
Proud to be a Super User!
Hi @Gilgam
Yes you can check the data type like this
if [Files] is table then "Table" else if [Files] is list then "List" else if [Files] is record then "Record" else null
In your case you can check for a table and then expand it like this
if [Files] is table then Table.ExpandTableColumn() "Table" else [Files]
I can't fill in the arguments for the Table.ExpandTableColumn function as I don't know the structure of your data, you will need to do that. Or post back here with sample data so I can help with it.
Regards
Phil
Proud to be a Super User!
Thank you very much ! I managed to do it with your post and Excel file !
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |