This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi there,
I am trying to build a function that goes through a column/list and checks whether the data stored is of type record or list. The function is below:
- - - - - - - - - - - - - - - - - -
fx ColumnChecker =
Here is the column in question that is throwing the error:
The result I'm expecting to get is that since the column has no record/list entries, variable i will iterate until it surpasses the RowCount ("else if i >= RowCount") at which point it will exit the loop and return 0. This process works when I put in a static number ("else if i >= 50") but I need it to be dynamic and adjust to the size of the list being passed to the function. When debugging, the error was thrown whenever i reached the RowCount (try...otherwise error i returned 348, which is the # of rows in the test data I was using)
Solved! Go to Solution.
If I understand your use case, here is one way to do it. I made this this list and called it ListToCheck
= {1,"text", {1..3}, [A="text"]}
Then used this expression that returned a value of 2 (1 list and 1 record).
= List.Count(List.Select(List.Transform(ListToCheck, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
If that works, you can convert it to a function with (didn't check this one but I think it will work)
(listname as list) =>
let
x = List.Count(List.Select(List.Transform(listname, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
in
x
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
If I understand your use case, here is one way to do it. I made this this list and called it ListToCheck
= {1,"text", {1..3}, [A="text"]}
Then used this expression that returned a value of 2 (1 list and 1 record).
= List.Count(List.Select(List.Transform(ListToCheck, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
If that works, you can convert it to a function with (didn't check this one but I think it will work)
(listname as list) =>
let
x = List.Count(List.Select(List.Transform(listname, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
in
x
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the April 2026 Power BI update to learn about new features.
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 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |