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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
garythomannCoGC
Impactful Individual
Impactful Individual

Script to show row total counts of all tables of a dataset

Was wondering if there is a straight forward way to script dax (or some other language) ?

Rather than writing the same/similar dax again and again for common needs would nice to put in a bit more effort to create repeatable scripts to do the job now and into the future.

For example, everytime we use a new/unfamiliar dataset it would be nice to fire a script against the dataset to show say total record counts of all the tables within.

A simple dax code got me started now I want to make this generic for all the tables in any dataset.

 

-- show table counts
EVALUATE
UNION (
    ROW ( "Table", "Benefit Realisation List", 
          "Count", COUNTROWS('Benefit Realisation List') ), 
    ROW ( "Table", "Project Achievability Y1 List", 
          "Count", COUNTROWS('Project Achievability Y1 List') ) 
)

-- show column stats for every table
--EVALUATE COLUMNSTATISTICS()

 

I am aware of the tablur editor and c# scripting so maybe this is the only way to go.

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

The problem regarding tabular editor scripts are that they are meant for modifying the model.bim file. Because of this you can't really use them to analyze the model data. However DAX studio's metric pane does what you are looking for pretty well: 

ValtteriN_0-1644823408254.png



E.g. in the "summary" section you can see the amount of tables, columns and the size of the model.


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
garythomannCoGC
Impactful Individual
Impactful Individual

ValtteriN
Super User
Super User

Hi,

The problem regarding tabular editor scripts are that they are meant for modifying the model.bim file. Because of this you can't really use them to analyze the model data. However DAX studio's metric pane does what you are looking for pretty well: 

ValtteriN_0-1644823408254.png



E.g. in the "summary" section you can see the amount of tables, columns and the size of the model.


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.