Forum Discussion

fabiomanniti's avatar
fabiomanniti
Helper III
4 years ago

Loop on all tables

Hello, I am making a new table which returns me the row counting of all other tables in the dataset

What I am doing right now is

 

row_counts = UNION(
ROW("table_name","table1","row_count", COUNTROWS(table1)),
ROW("table_name","table2","row_count", COUNTROWS(table2)),
ROW("table_name","table3","row_count", COUNTROWS(table3)),
...
)

 

but this means that I need to add manually all tables I have in a dataset.

Is there a way to loop through it? In this way, if I import new tables I don't need to modify manually that counting row table

 

Thanks 

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi fabiomanniti ,

     

    You are correct. DAX is not like oracle which has a simply command  "select table_name, num_rows from all_tables" that can return all table names and number of records.

     

    Best Regards,

    Jay