This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Totally new to Power BI and just can't get my head around this !!
I want to create a Measure that uses an if statement in my Model Table. I can write the if statement ok I just want to return a combination of a field on my table and text.
Solved! Go to Solution.
figured this out. I created a new column within the data environment and used the following syntax (which I guess was the problem all along !!.
figured this out. I created a new column within the data environment and used the following syntax (which I guess was the problem all along !!.
Hi Nate
I tried your suggestion with a test using the following:
if [Field1] = "OK" then "OK" else "Error -"& ([Field2])
Field1 is a calculation returning text "OK"
Field2 is a numerical value
This still has an orange "error" where the condition is not met with the Expression error:
Expression.Error: We cannot apply operator & to types Text and Number.
So then I tried to concatenate like so:
if [Field1] = "OK" then "OK" else "Error -"&Number.ToText([Field2])
Now I get "Error -1" but it isn't yellow and does not link to an explanation.
Any ideas?
You don't need all the parentheses. Just try this:
Measure = if [Field1] = 0 then "OK" else "Error -"& [Field2]
--Nate
Hi there Vera
I figured out that I should be doing this in query (which I have made progress with however I still can't get my formula to concatenate data with text.
My formula is fine until I try to concatenate:
if [#"Trunks & Radials (RPE).RPE Plan"]=[#"Loads (Driver Vehicle).Planned_Total_RPE"] then "OK"
else "Check - "&Text.From[#"Trunks & Radials (RPE).RPE Plan"]&" vs "&Text.From[#"Loads (Driver Vehicle).Planned_Total_RPE"]
The "OK" is present where the condition is met but there is an error where the condition is not met:
(If I use text ("OK" and "Not OK") for both then it works, however I need to concatenate data to create information for the viewer.)
The error message states:
Expression.Error: We cannot apply field access to the type Function.
Details:
Value=[Function]
Key=Trunks & Radials (RPE).RPE Plan
Thanks for your help and patience in advance.
Hi @Anonymous
What error did you get? It is better to provide some sample data...if it is a measure, you can't call a field directly...
Hi @Anonymous
So it is a column, you missed () for the Text.From, but your error was not about it, the question is how you put your if statement? Did you add a custom column in Power Query Editor then put it like this?
if [#"Trunks & Radials (RPE).RPE Plan"]=[#"Loads (Driver Vehicle).Planned_Total_RPE"] then "OK"
else "Check - "&Text.From([#"Trunks & Radials (RPE).RPE Plan"])&" vs "&Text.From([#"Loads (Driver Vehicle).Planned_Total_RPE"])
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.