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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
santhoshacc
Frequent Visitor

Need help on the .net code for updating the M expression code with .net for SSAS Tabular model

Hi All,

 

Kindly help on the code for updating the M expression code with .net for SSAS Tabular model.

 

Scenario:

we have table with partition and we have to update the partition query using .net

 

we have code to replace the existing M Expression with New one ,unfortunately the changes are not updating in Database LEVEL .(SSAS Tabular) .May be i missed any syntax of the .net code.

 

Please see below code and help out in this.

 

TOA.Partition partition = m.Tables.Find(Table).Partitions[1];

 

OverrideCollection oc = new OverrideCollection
{

Partitions =
{
new PartitionOverride
{

OriginalObject =partition,

Source = new MPartitionSourceOverride
{
Expression=expressions

}


}


}

};



var listOc = new List<OverrideCollection>();
listOc.Add(oc);
partition.RequestRefresh(TOA.RefreshType.Add, listOc);

// m.Tables[Table].Partitions[1].Refresh(TOA.RefreshType.Full, listOc); //it is not working 
db.Update(UpdateOptions.ExpandFull);

db.Model.SaveChanges();
m.SaveChanges();

TOA.Partition partition1 = m.Tables.Find(Table).Partitions[1];

 

 

Thanks,

Santhosh

0 REPLIES 0

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.