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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JAVED
Helper I
Helper I

Case statement in DAX

Hi

 

Here i have a DAX Statement as

 

CASE (WHEN stricker<>'' OR NONSTRIKER<>'' THEN (RUNS + (CASE WHEN BYES = 0 AND LEGBYES = 0 THEN OVERTHROW ELSE 0 END))
WHEN @BOWLER<>'' THEN (RUNS + WIDE+ (CASE WHEN BALL.NOBALL > 0 AND (BALL.BYES > 0 OR BALL.LEGBYES > 0) THEN BALL.BYES + BALL.NOBALL + BALL.LEGBYES
WHEN BALL.NOBALL > 0 AND BALL.BYES = 0 AND BALL.LEGBYES = 0 THEN BALL.NOBALL
ELSE 0 END) + (CASE WHEN BYES = 0 AND LEGBYES = 0 THEN OVERTHROW ELSE 0 END))
ELSE GRANDTOTAL END ) AS RUNS

 

 

But it is showing as error in my Dax i am  unable to find out the error why it is not executing the statement

 

 

When i am 

5 REPLIES 5
JAVED
Helper I
Helper I

Thank you @prateekraina

@JAVED,

As prateekraina's post, you would need to use Switch or if statement in DAX. If you have questions about the DAX, please share sample data of your tables and post expected result following the guide in this thread: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
prateekraina
Memorable Member
Memorable Member

Hi @JAVED,


Try Using SWITCH or IF-ELSE . CASE is not supported in DAX.

 

Also, you have posted the question on wrong forum. This forum is used for reporting Bugs.
If you need any technical help you should post the question on this forum.

 

Regards,

Prateek Raina

JAVED
Helper I
Helper I

Sorry, this is Sql statement i have to convert to DAX

prateekraina
Memorable Member
Memorable Member

@JAVED Are you sure this is DAX?? I don't think DAX looks like above.

Helpful resources

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.