Change the Expression of a (existing) field Parameter Table via script #1403
Answered
by
otykier
NaHolla
asked this question in
🙋♀️TE3 Q&A
-
I have a table which is defind as a field Parameter (which I've customized) TableName = "TOP-Kategorie" Now, I'd like to update the expression var targetTable = Model.Tables["TOP-Kategorie"]; var MyNewExpression = ReadFile(@"U:...\TabularMeasures\TOP-Kategorie.csv"); // this works targetTable.Expression = MyNewExpression ; //not working |
Beta Was this translation helpful? Give feedback.
Answered by
otykier
Nov 27, 2024
Replies: 1 comment 4 replies
-
Are you connected to Power BI Desktop while trying to run this script? If so, could you try to enable the Allow unsupported modeling operations option under Tools > Preferences > Power BI Desktop: |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh I see - you didn't mention that you got an error message in your original post - so I just assumed the script ran without error but didn't change anything.
In any case, it's an easy fix. You just need to explicitly cast the table to type
CalculatedTable
before attempting to access theExpression
property. Like so: