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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Help with Switch case

Hi,

I have to add custom column called "score".For that i have to add switch case as below: 

 

CASE

WHEN isnull(N_SUM_of_Absolute_us...) THEN 

WHEN (N_SUM_of_Absolute_us... NOT NULL) and isnull(Y_SUM_of_Absolute_us...) THEN 1

ELSE round(N_SUM_of_Absolute_us.../(N_SUM_of_Absolute_us... + Y_SUM_of_Absolute_us...), 4)

 END

 

Can someone help me how to do this.

Thanks.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

Thank you so much.It worked.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Anonymous 
There is no isnull function in DAX  and N_SUM_of_Absolute_us... and Y_SUM_of_Absolute_us... are columns so, need an aggregate function. Try create the measure with ISBLANK():

 

Measure = SWITCH( TRUE(),
ISBLANK(max([N_SUM_of_Absolute_us...])), 0,
ISBLANK(max([Y_SUM_of_Absolute_us...])), 1,
round(MAX([N_SUM_of_Absolute_us...])/(max([N_SUM_of_Absolute_us...]) + max([Y_SUM_of_Absolute_us...])),4)
)

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Anonymous 

Thank you so much.It worked.

CNENFRNL
Community Champion
Community Champion

Hi, @Anonymous , you may apply such a pattern to your measure,

 

Measure = 
SWITCH( TRUE(),
ISNULL(N_SUM_of_Absolute_us...), 0,
ISNULL(Y_SUM_of_Absolute_us...), 1,
round(N_SUM_of_Absolute_us.../(N_SUM_of_Absolute_us... + Y_SUM_of_Absolute_us...), 4)
)

 

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Hi @CNENFRNL ,

When am trying to apply that it is showing the below error.

Note : Even i changed the table name.still it showing the same error.Screenshot from 2020-11-16 12-11-21.png

Thanks.

Helpful resources

Announcements
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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.