cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

PowerBi add new column. value if blank

HI,

 

Am trying to add a new column in Powerbi, by extracting the data from another column, if the extrated data is blank, i need to do another type of extraction.

 

Am trying with the following, which is not working and getting  error like "IF wasn't recognized"

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: PowerBi add new column. value if blank

M is case sensitive and the if syntax is different in the query editor (M) than it is in DAX - IF(  ).  You need to use lower case and have 

 

if ... then ... else

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

View solution in original post

4 REPLIES 4
Highlighted
New Member

Re: PowerBi add new column. value if blank

Screenshot 2020-06-19 at 04.25.17.png

Highlighted
Community Champion
Community Champion

Re: PowerBi add new column. value if blank

M is case sensitive and the if syntax is different in the query editor (M) than it is in DAX - IF(  ).  You need to use lower case and have 

 

if ... then ... else

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

View solution in original post

Highlighted
Super User IV
Super User IV

Re: PowerBi add new column. value if blank

@haidars  do not use ( after if

example

New Margin = ((if [Item.Brand] = "Brand 1" then 5 else  
		if [Item.Brand] = "Brand 2" then 5.5 else 
		if [Item.Brand] = "Brand 3" then 6.0 else 
		if [Item.Brand] = "Brand 4" then 6.5 else 
		7.0 )*([Qty]*[Price]) *((100-[Discount Percent])/100))/100


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Microsoft
Microsoft

Re: PowerBi add new column. value if blank

Hi , @haidars 

Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread.
It will help other community members easily find the solution when they get the similar issue.

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors