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

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.

Reply
Colton_J
Frequent Visitor

"List" turning into "[List]", creating errors. Help!

I've got a rather large report and one of the operations require that I iterate through a list and check if the value is in another column, in another table. So basically I'm adding a column and for each row's list pass it into a function check if any of those list values are in this other table. I've taken that other table's column and buffered the list to speed things up, but the biggest issues I'm finding are with the List.Contains method. When using that, the column with the lists I'm checking somehow get turned into a text form or something. They go from yellow text saying "List" to black text saying "[List]" and then in that new column I only get errors that say: "We can't convert "[List]" to type List. What is weird, is that if I run this query by itself in its own query it works fine, also when I first implemented it into the large report it worked as well, but then the next day it did this whole error thing when nothing was changed. Any ideas why this might be happening or possible fixes? Thanks!

4 REPLIES 4
ImkeF
Super User
Super User

This is very hard to determine just from the text you wrote. Could you please create some sample data that shows the behaviour?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Ok, so lets say I have column1 with each row containing a list of numbers.

 

Column1

List

List

List

 

And I have my function which is like:

myFunc = (theList as list) as number =>

let

    //code...

    newList = List.Transform(theList, each if List.Contains(bufferedList, _ ) then 0 else 1),

    //more code...

in

    out,

 

So, when I do:

NewColumn =  Table.AddColumn(#"Prev Table", "NewColumn", each myFunc([Column1])),

 

In the smaller report, each item in NewColumn is a number and all the lists in Column1 stay lists. 

But, in the large report, it is as if the List types are turning into text and losing all data that was contained within that list.

So when you run that step, in Column1, "List" turns into "[List]" on each row, and in NewColumn, all items are Errors that say "Cannot turn type "[List]" into type List"

 

What is kind of weird though, is that on some computers it works, and sometimes on the computers where it works, it will stop working at some time.

Looks like a bug to me.

 

What else you can do is: Add a column with "Value.Is([Column1], type list)", filter on FALSE and examine the findings.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Yeah, Value.Is revealed nothing, they are all indeed lists... Must be a bug

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.