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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Marco_88
Helper I
Helper I

Read explained formula

Hello everyone,

I've this problem.
I have a Table TAB1 with some columns TAB1_n, TAB1_A, TAB1_B, TAB1_C, TAB1_D, with some numerical data.
I have also a Table TAB2 with these columns TAB2_n, TAB2_A, TAB2_B, TAB2_C, TAB2_D, TAB_E, TAB_F.
I Created a new merged table called Merge1.

In Merge1 I added a new column called QTY that has:
- in case of column TAB2_A, TAB2_B... report an "X", PBI will copy in QTY column the corresponding data from TAB1_A, TAB1_B...
- in case of column TAB2_A, TAB2_B doesn't have an "X" value, it looks at column TAB_F if there is a formula. If it's true, it will calulate value from the formula based on Name of TAB1 and report results in QTY column.

like this:

Formula.PNG


My problem is that I can't get PBI to read the formula.
Can anyone help me?

 

Thank you in advance

Marco

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Marco_88 ,

DAX cannot make this however you can do it using Power Query.

 

Your merge table should have the following format:

 

MFelix_1-1718983391825.png

 

Has you can see I replaced the X by the values of each line.

 

Now do a merge with the Tab 1 on N and expand the table A, b, C ,D

MFelix_2-1718983417261.png

Now add the following custom column:

Expression.Evaluate( Text.Replace(Text.Replace(Text.Replace(Text.Replace([FORMULA],"A",Number.ToText([A])),"B",Number.ToText([B])),"C",Number.ToText([C])),"D",Number.ToText([D])))

MFelix_3-1718983457369.png

Now delete the columns ABC

Final result:

MFelix_4-1718983491362.png

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Marco_88 ,

DAX cannot make this however you can do it using Power Query.

 

Your merge table should have the following format:

 

MFelix_1-1718983391825.png

 

Has you can see I replaced the X by the values of each line.

 

Now do a merge with the Tab 1 on N and expand the table A, b, C ,D

MFelix_2-1718983417261.png

Now add the following custom column:

Expression.Evaluate( Text.Replace(Text.Replace(Text.Replace(Text.Replace([FORMULA],"A",Number.ToText([A])),"B",Number.ToText([B])),"C",Number.ToText([C])),"D",Number.ToText([D])))

MFelix_3-1718983457369.png

Now delete the columns ABC

Final result:

MFelix_4-1718983491362.png

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.