top of page

Data Refresh in Tabular Editor

  • MK
  • Mar 17, 2021
  • 3 min read

Updated: Jun 21, 2022

***The scripts shown in this post have been updated to work in both Tabular Editor 2.x & Tabular Editor 3.


Tabular Editor offers so many inherent features which make it such an invaluable tool for developing tabular models. However, what makes it even better is the ability to write custom C# code using the Advanced Scripting window. This creates a plethora of possibilities only limited by the imagination. Many of my recent posts take advantage of this feature and this post is no exception.


As with all nifty advanced scripts, I recommend saving these scripts as Custom Actions so you can have easy access to them at any time.


Processing multiple tables


It has previously been shown how to refresh a table within Tabular Editor but we can take it a step further. The script below is able to process multiple tables - not just a single table. Naturally, it can also process a single table. Here's how it works:


Note: This requires Tabular Editor version 2.12.1 or higher and that you are connected live to an Analysis Services instance (File->Open->From DB...). This can also be a Power BI Premium dataset or if Tabular Editor is opened using the Power BI Desktop 'External Tools' option.


  1. Within Tabular Editor, select the tables you want to process within the Table List.



2. Copy and paste the code below into the Advanced Scripting window (save it as a Custom Action).


#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;

var refreshType = ToM.RefreshType.DataOnly;
ToM.SaveOptions so = new ToM.SaveOptions();
//so.MaxParallelism = 10;

foreach (var t in Selected.Tables)
{
    string tableName = t.Name;
    Model.Database.TOMDatabase.Model.Tables[tableName].RequestRefresh(refreshType); 
}

Model.Database.TOMDatabase.Model.SaveChanges(so);

3. Update the refreshType parameter according to how you would like to process the tables. The options are documented here.


4. If you want to use the Sequence command to specify the Max Parallelism option, simply uncomment the 'so.MaxParallelism' line and specify the desired MaxParallelism value.


5. Click the play button (or press F5) to start the data refresh.


Processing multiple partitions


The only difference in processing partitions is that you select partitions. Otherwise, the instructions are the same as for processing tables. Just use the code below.


#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;

var refreshType = ToM.RefreshType.DataOnly;
ToM.SaveOptions so = new ToM.SaveOptions();
//so.MaxParallelism = 10;

foreach (var p in Selected.Partitions)
{
    string tableName = p.Table.Name;
    string partitionName = p.Name;
    Model.Database.TOMDatabase.Model.Tables[tableName].Partitions[partitionName].RequestRefresh(refreshType); 
}

Model.Database.TOMDatabase.Model.SaveChanges(so);

Processing the model


Processing the whole model is not recommended. However, recalculating the model is fine. Just these 4 lines of code are needed to do the job. Simply paste this code into the Advanced Scripting window and click play.


#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;

var refreshType = ToM.RefreshType.Calculate;
Model.Database.TOMDatabase.Model.RequestRefresh(refreshType); 
Model.Database.TOMDatabase.Model.SaveChanges();

additional context


These scripts directly access the Tabular Object Model and actually do not generate TMSL (to which many of us are accustomed). The scripts (well, the RequestRefresh method) generate XML. TMSL is much cleaner and easier to read which is why it is used when scripting out code in this context. However, the TMSL gets translated into XML by the engine. Therefore, the scripts used in this post skip the TMSL part and feed XML directly to the server (since the engine does not care about code beautification). You can run a SQL Server profiler trace and see this for yourself. Actually, when you run TMSL you will also see the XML command (translated from TMSL) in the profiler trace. When you run a profiler trace against the scripts in this post you will only see the XML command.


Conclusion


It should be noted that processing large datasets within Tabular Editor is not recommended. This method is best for quickly processing relatively smaller datasets. Not to worry, I have a new tool coming out soon which offers a more robust solution for more complex processing scenarios. Stay tuned!

156 Comments


Debra Wermont
Debra Wermont
6 hours ago

This is a great walkthrough — understanding how DataRefresh in Tableau Editor works helps users keep dashboards up‑to‑date and ensures that insights always reflect the latest data, which is essential for accurate decision‑making. Being able to automate refreshes and manage data connections efficiently saves time and makes analytics more reliable across teams. In broader business environments where organizations juggle multiple projects, initiatives, and priorities at once, having clarity and coordination matters just as much, which is why many teams look into Top 15 Portfolio Management Tools to help them organize work, align resources, and keep complex efforts running smoothly.

Like

meery232ww
5 days ago

Using technology to increase access to youth mental health support may offer a practical way for young people to reach guidance, safe-spaces, and early help without feeling overwhelmed by traditional systems. Digital platforms, helplines, and apps could give them a chance to seek support privately, connect with trained listeners-orexplore resources that might ease their emotional load. This gentle shift toward tech-based support may encourage youth to open-up at their own pace, especially when in-person help feels too heavy to approach.

There is always a chance that these tools-quietly make support feel closer than before, creating moments where help appears just a tap-Berlinintim away. Even a small digital interaction might bring a sense of comfort. And somewhere in that space, you…

Like

meery232ww
5 days ago

Detailed and practical, this guide explains concrete rebar in a way that feels approachable without oversimplifying. The step by step clarity is especially useful for readers new to the subject. I recently came across a construction related explanation on https://hurenberlin.com that offered a similar level of clarity, and this article fits right in with that quality. Great شيخ روحاني resource. explanation feels practical for everyday rauhane users. I checked recommended tools on https://www.eljnoub.com

s3udy

q8yat

elso9

Like

The msc meaning focuses on the transition from a generalist perspective to a specialist authority in a chosen field. This shift is vital for anyone looking to stand out in a saturated labor market. UniCCM provides various guides on how a Master of Science can help individuals pivot their careers into entirely new industries.

Like

Kurlon
Kurlon
Dec 25, 2025

When I started using Shikshade I noticed how much easier exam prep becomes when everything is organized in one place. Browsing through notes, opening PDFs, and checking updated exam details helped me catch things I would have missed on my own. Simple features like clear syllabus pages or quick access to previous papers save a lot of time and make studying feel less scattered.


Like

©2021 by Elegant BI

bottom of page