POWER BI - Formula is a string, need it calculating

danieltock

New Member
Joined
May 17, 2016
Messages
7
Hello,

I have a column that determines the formal needed, with a b and C within it.
A, B and C are independent columns.
When I substitute A,B abd C for the values it doesn't calculate the answer..

How can I fix this?

Example;

A=700
B = 36
C = 0

formula = A-(2XB)

Answer = 700-(2X36)

I want it to say 628.

Thanks,
Dan
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
In the query editor (Power Query or M):

Code:
let
    A=700,
    B=36,
    C=0,
    Formula = "A-(2*B)",
    Answer = Expression.Evaluate(Formula, [Formula = Formula, A=A, B=B])
in
    Answer

Expression.Evaluate
 
Last edited:
Upvote 0
Another way:
Input Code in Advanced Editor in Power Query

Code:
let
    Query1 = #table({"A","B","C"},{{700, 36, 0}}),
    #"Added Custom" = Table.AddColumn(Query1, "Answer", each [A]-2*[B])
in
    #"Added Custom"
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top