Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi
I have two columns one numeric [number] and one text [name] and i want to make an if statement with them
each if ([name] = "AANNAA") and ([number]> 140) then "Yes" else "No"
it does not work, i guess because two different data types. i always create a workaround with three steps and two conditional columns.
Is it possible to have it in one if without changing data type?
Solved! Go to Solution.
it works
let
my_table = #table(type table [name = text, number = number], {{"BBB", 150}, {"AANNAA", 145}, {"AANNAA", 135}}),
it_works = Table.AddColumn(my_table, "if_statement", each if ([name] = "AANNAA") and ([number]> 140) then "Yes" else "No")
in
it_works
The if statement you show is fine.
What is the error you get and in what context do you use the if?
Please share your code and a screenshot of the error message.
My guess: The if returns a text, but the destination of that result does not accept text...
Hi @kkarol ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Thanks and regards
Hi @kkarol ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you
Hi @kkarol ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
@PwerQueryKees @AlienSx so i guess that is not a problem. i will investigate it and come back to You. Thanks for Your replies.
The if statement you show is fine.
What is the error you get and in what context do you use the if?
Please share your code and a screenshot of the error message.
My guess: The if returns a text, but the destination of that result does not accept text...
it works
let
my_table = #table(type table [name = text, number = number], {{"BBB", 150}, {"AANNAA", 145}, {"AANNAA", 135}}),
it_works = Table.AddColumn(my_table, "if_statement", each if ([name] = "AANNAA") and ([number]> 140) then "Yes" else "No")
in
it_works
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
9 | |
8 | |
6 | |
6 | |
6 |