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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.