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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Add New Column (flag)

Hi world!

I came from the green side (Qlik) so I´ve found some problemns developing some "script" tasks that for sure you will help me

It´s really easy.

I want to add a new column (flag column) with values 0 and 1 when the following isntructions:

 

****Column ID is NULL  AND Column TYPE is different than the value "house"****

 

ID,TYPE,FLAG,
123house0
21232garage0
4235store0
24house0
 garage1
 store1
 house0
 garage1
 store1

 

In Qlik should be something like if(isnull(ID) and TYPE <>"house",1,0)  


But I am a beginner in DAX model so I need some help

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Anonymous

 

Try this formula

 

Column = IF(LEN(Table[COLUMN_D])=0 && Table[TYPE] <> "house",1,0)

 

OR

 

Column = IF(Table[COLUMN_D]=BLANK() && Table[TYPE] <> "house",1,0)

 

View solution in original post

5 REPLIES 5
Omega
Impactful Individual
Impactful Individual

Try 

 

Flag = IF(ISBLANK(Table2[ID]) && Table2[TYPE,] <> "House",1,0)
themistoklis
Community Champion
Community Champion

@Anonymous

 

Try this formula

 

Column = IF(LEN(Table[COLUMN_D])=0 && Table[TYPE] <> "house",1,0)

 

OR

 

Column = IF(Table[COLUMN_D]=BLANK() && Table[TYPE] <> "house",1,0)

 

Anonymous
Not applicable

There is a problem with the formula the PBI says the following " Token RoghtParen expected"  and select the first coma "," --> 

,1,0)

 any idea?

@Anonymous

 

Where did you put the formula? It seems that you are creating a column using Power Query.

This is a DAX formula.

 

Also based on regional settings the comma can be replaced with semicolon ' ; '

Anonymous
Not applicable

Ok I got it!!! I was trying to edit the query, I was in the wrong section.

Thanks all for the responses,  BTW I needed ";" instead of "," 

😉

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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