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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
AsmaAlNashash
Frequent Visitor

Switch Case based on NULL values

Hi, I am currently trying to do something very simple. I want to create a new column in which if only the first column is Not Null, the value will be 1. If the First and Second columns are not Null then the value will be 2, and so on. The columns are from different tables.

I was not able to Use ISBLANK() with a SWITCH Function.

Here is an example to make it clear.

 

AsmaAlNashash_0-1665487451183.png

 

Anyone have any ideas would be appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Asma,

I have created dummy data for your reference, hopefully your requirement is fulfilled.

Note: You can use LOOKUPVALUE Dax in order to get columns from different tables.

Dax - 

Column =
Var a= if(ISBLANK('Table (2)'[Column1]),0,1)
var b = if(ISBLANK('Table (2)'[Column2]),0,1)
var c = if(ISBLANK('Table (2)'[Column3]),0,1)
var d = if(ISBLANK('Table (2)'[Column4]),0,1)
Var e = a+b+c+d
return e


Please refer to the below image.

Monika_23_0-1665489362370.png

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi Asma,

I have created dummy data for your reference, hopefully your requirement is fulfilled.

Note: You can use LOOKUPVALUE Dax in order to get columns from different tables.

Dax - 

Column =
Var a= if(ISBLANK('Table (2)'[Column1]),0,1)
var b = if(ISBLANK('Table (2)'[Column2]),0,1)
var c = if(ISBLANK('Table (2)'[Column3]),0,1)
var d = if(ISBLANK('Table (2)'[Column4]),0,1)
Var e = a+b+c+d
return e


Please refer to the below image.

Monika_23_0-1665489362370.png

 

Samarth_18
Community Champion
Community Champion

Hi @AsmaAlNashash ,

 

You could try like this:-

 

StageID =
IF ( ISBLANK ( MAX ( 'Table (1)'[Column1] ) ), 0, 1 )
    + IF ( ISBLANK ( MAX ( 'Table (2)'[Column2] ) ), 0, 1 )
    + IF ( ISBLANK ( MAX ( 'Table (3)'[Column3] ) ), 0, 1 )
    + IF ( ISBLANK ( MAX ( 'Table (4)'[Column4] ) ), 0, 1 )

 

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.