cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
REWINDER
Frequent Visitor

Execute syntax formatted as string

Hi,

I have been looking for a solution to execute syntax saved in a table, formatted as string.

For example:
I have a table with expressions in a column ('Table'[Expression]) where a string value is:

Sum('table'[Column])

I would like to call on-, and execute this expression in a measure, for example:

Selectedvalue('table'[Expression])

 

Naturally it returns the string: Sum('Table'[Column])

 

How do I get it to execute this?

 

Your help is much appreciated!

3 REPLIES 3
Rewinder_R
New Member

@v-zhangti :
Please see here a download link to a PBIX file containing all necessary tables and measures for reference. 
https://we.tl/t-Asm9f9fc7M

I would be really greatful for any input, or hint in the  right direction.

Regards,

v-zhangti
Community Support
Community Support

Hi, @REWINDER 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi v-zhangti,

Thank you for your reply,
I am not sure what is the easiest way to share data, therefor I have put together two tables and the measure example.

Expected outcome: Should the measure in the table return 150000litres for a given filtered FY, this is what I hope tyo achieve with a measure referencing the expression in the MetaData table.

Something like: 

 

Selectedvalue('table'[Expression])

 

 

Metadata measure table

MeasureName

Expression

#LitresFuel

Sum('Fueltransaction'[Litres])

 

 

 

Table Fueltransaction

TransactionLitres
FY23150000

 

 

I hope this helps,

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors