
You're trying to dynamically use a variable as a data source in a ForAll loop in Power Apps, where each value in your colDS collection represents a different Dataverse table name (e.g., 'Shipments-FY2024', 'Shipments-FY2019', etc.). Unfortunately, Power Apps does not support dynamic table references directly using variable values inside ForAll or Filter.
In Power Apps, data sources must be statically defined at design time. You cannot use a string variable like DataLoop.YearDataSource to dynamically reference a table name. This is why you're getting an invalid data type error—Power Apps is treating DataLoop.YearDataSource as a string, not as a table.
Although it requires maintenance, this is currently the only supported method to handle dynamic table selection:
Switch(
DataLoop.YearDataSource,
"Shipments-FY2024", Filter('Shipments-FY2024', Solution = "CompanyName"),
"Shipments-FY2019", Filter('Shipments-FY2019', Solution = "CompanyName"),
...
)
You can wrap this inside a function or reuse it across your app to reduce duplication.
If possible, consider consolidating all yearly tables into a single Shipments table with a Year column. This allows you to filter dynamically:
Filter(Shipments, Year = DataLoop.Year && Solution = "CompanyName")
This is the recommended architectural approach in Dataverse to avoid fragmentation and improve maintainability.
If you need dynamic table access, you can offload the logic to a Power Automate flow:
This adds complexity but gives you full control over dynamic logic.
Set() or UpdateContext() inside ForAll—they’re not allowed because ForAll runs in a separate evaluation context.With() to scope expressions if needed, but it won’t help with dynamic table names.