Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Gilgam
New Member

Variable data in a column

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 !

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Gilgam 

 

Download example XLSX file

 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Gilgam 

 

Download example XLSX file

 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you very much ! I managed to do it with your post and Excel file !

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors