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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Analytics1
Frequent Visitor

Need to use Text from a table as formula in Power BI

Hi Team,

 

I am working on creating Power BI reports which are embedded for clients in our companies' SaaS application. However, given the number of customers, we see requirements for different formulae to calculate the same metric. 

 

We only want client to see numbers based on their own formula, so we get a reference key from the application to understand what formula the client uses and then write NESTED IF statements to arrive at the final formula. However, this leads to multiple iterations and deployments after updating the NESTED IF statement.

 

As a solution, we are thinking of creating a table which has the different "formulae" written in different rows (example below). So, if we have to add a new formula in the future, we can directly add it to the table and it will flow into the file.

KeyFormula
1CALCULATE(COUNT('Employee Attributes'[User ID]))
2CALCULATE(COUNT('Employee Attributes'[User ID]), FILTER('Employee Attributes', 'Employee Attributes'[Designation]<>Blank()))

 
Now, we will use this as the reference. If a client has chosen the first formula in our settings then their dashboard only has the first row from the above table. We want to pick the value from the "Formula" column of the table and use it as the DAX expression (Example below)

Employee Count = FIRSTNONBLANK('Formulae'[Formula], False())

However, currently it returns the string as is from the "Formula" column.

 

Is there a way to use it as a formula?
 

2 REPLIES 2
Anonymous
Not applicable

Hi @Analytics1

 

Can you share sample data and sample output in table format or a sample pbix? Please remove any sensitive data in advance. We can better understand the problem and help you.

Best Regards,
Community Support Team _Yuliax

Fowmy
Super User
Super User

@Analytics1 

Using a table to store different DAX formulas for clients is not a great approach, trying to dynamically interpret a DAX expression from a table poses challenges. DAX doesn't have a direct function to evaluate a string as a formula within a calculated column or measure.



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors