Forum Discussion

luxuror's avatar
luxuror
New Member
8 years ago
Solved

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! 

  • 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. :smileyhappy:

     

    Thanks,
    Xi Jin.

4 Replies

  • popov's avatar
    popov
    Resolver III
    Hello, try this
    Flag = IF( Data <> BLANK(), "Y")
    • luxuror's avatar
      luxuror
      New Member

      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

      • v-xjiin-msft's avatar
        v-xjiin-msft
        Solution Sage

        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. :smileyhappy:

         

        Thanks,
        Xi Jin.