Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to iterate over table names within a loop

I am working in Power BI with customer survey data that is set up in a less than ideal way. Instead of adding each new survey's information to an overall table, the database was set up with each surv...
  • danextian's avatar
    3 years ago

    Hi Anonymous ,

     

    You can't loop tables in DAX. You'll have to specify each table when you create a measure/calculated column/measure. Use Power Query to combine relevant tables into one. 3

     

    When you connect to a database, say Access, the navigation prompt normally lets you choose which table to connect to. If you move a few steps back you will see all available tables in that database. You can opt to  expand the data column/the column which contains the data of each table instead of accessing just one specific table. Of course, you need to filter out all the other uneeded tables first before expanding. This will create a single table of all tables in that database that meet your  criteria. Note:This approach can be slow (as this is similar to looping) depending on the data source size/server speed, etc.