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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
luxuror
New Member

New Column Flag Based on Existing Column Content

Hello, 

 

I'm trying to create a new column that flags as "1" or "Y" when existing column A has data. Column A populates dates but not all rows have dates. So the desired result would look like something below: 

 

DateFlag
1/1/2018Y
2/3/2018Y
  
3/13/2018Y
  
  
2/2/2018Y
3/1/2018Y

 

Thank you! 

1 ACCEPTED SOLUTION

Hi @luxuror,

 

This is a DAX expression and it is used in Data Modeling.

 

What you have done: entered it after going through the edit query option on the home tab and selecting add a custom column option. It is using Power Query not DAX. This is different. Also you should know that it is able to use if statement in Power Query. However Power Query is case sensitive, so if statement in Power Query is if not IF.

 

Then for your scenario, there's no need to go to Edit Queries. Just go to Modeling pane -> choose New Column -> create this new calculated column with above DAX expression.

 

Little tips: you should make some effort on DAX and Power Query in Edit Queries. Smiley Happy

 

Thanks,
Xi Jin.

View solution in original post

4 REPLIES 4
v-xjiin-msft
Solution Sage
Solution Sage

Hi @luxuror,

 

Try this:

 

Falg =
IF ( ISBLANK ( 'Table'[Date] ), BLANK (), "Y" )

1.PNG

 

Thanks,
Xi Jin.

Hello @v-xjiin-msft and @popov

 

I tried entering this equation but power bi did not recognize the IF statement and thought it was a name. I entered it after going through the edit query option on the home tab and selecting add a custom column option. I'm not sure if I just entered this in the wrong area. 

 

Thank you

Hi @luxuror,

 

This is a DAX expression and it is used in Data Modeling.

 

What you have done: entered it after going through the edit query option on the home tab and selecting add a custom column option. It is using Power Query not DAX. This is different. Also you should know that it is able to use if statement in Power Query. However Power Query is case sensitive, so if statement in Power Query is if not IF.

 

Then for your scenario, there's no need to go to Edit Queries. Just go to Modeling pane -> choose New Column -> create this new calculated column with above DAX expression.

 

Little tips: you should make some effort on DAX and Power Query in Edit Queries. Smiley Happy

 

Thanks,
Xi Jin.

popov
Resolver III
Resolver III

Hello, try this
Flag = IF( Data <> BLANK(), "Y")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.