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
Anonymous
Not applicable

Need urgent help with Dax formula for excluding

Hi Community, 

 

I have the following Formula : 

Marketable = if(AND(ISBLANK(CustomerDemos_Analytics[Personno])=FALSE(), CustomerDemos_Analytics[Marketableflag] = TRUE()), 1, IF(AND(ISBLANK(CustomerDemos_Analytics[Personno])=FALSE(), CustomerDemos_Analytics[Marketableflag] = FALSE()), 0,BLANK() ))
 
However I want to exclude the the blanks, so after the marketableflag = 0, it should exclude all the blanks.
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Approve with @AnthonyJoseph , based on your descrition, I have created a simple sample:

vjianbolimsft_0-1662625323171.png

Here is my method, please try:

Marketable = 
SWITCH(FORMAT([Marketableflag],"True/False"),
"True",1,
"False",0,
BLANK())

 Final output:

vjianbolimsft_1-1662625364139.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Approve with @AnthonyJoseph , based on your descrition, I have created a simple sample:

vjianbolimsft_0-1662625323171.png

Here is my method, please try:

Marketable = 
SWITCH(FORMAT([Marketableflag],"True/False"),
"True",1,
"False",0,
BLANK())

 Final output:

vjianbolimsft_1-1662625364139.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi @amitchandak 

 

Apologies for that. So basically I have a column from my original dataset called Marketable Flag, 

It consists of TRUE and FALSE, then some values are BLANKS.  I want to create a new column that converts the TRUE  values to 1 & FALSE values to 0 and EXCLUDES the Blank values. 

 

 

I hope this is clearer

 

 

Hi @Anonymous .... I'm not sure if I have understood your problem correctly but from what I understand-- you have a column ("Marketable Flag") that has 3 distinct value (True, False and Blank) and you need an expression to retain blank when the value is blank else it should return 1 or 0 if its true or false respectively.

 

If my understanding is correct, please can you try the below:

New Column =
If(
    ISBLANK(Table[Marketable Flag]), BLANK(),
    IF(Table[Marketable Flag] = TRUE(),1,0)
)

 I'm not sure what does EXCLUDE Blank mean in the problem but just shared my 2 cents from what I understood... 

 

Hope this helps!

 

Thanks,

AnthonyJoseph

 

 

amitchandak
Super User
Super User

@Anonymous The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

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.

Top Solution Authors