cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Need help on Power BI Query.

Hi team, I am currently working on my borganizational project and i am trying to create new measure for my database using below query. However i can't able to add new measure due to syntax error. Can someone please help me.

Risk Level = var Impact = AVERAGE(Output[RiskImpact])
var Likelihood = AVERAGE(Output[RiskLikelihood])
return
SWITCH(TRUE() ,
Impact > 0 && Impact <= 2 && Likelihood > 0 && Likelihood <=4 , "LOW" ,
Impact > 0 && Impact <= 2 && Likelihood > 4 && Likelihood <=5 , "MEDIUM" ,
Impact > 2 && Impact <= 3 && Likelihood > 0 && Likelihood <=4 , "MEDIUM" ,
Impact > 2 && Impact <= 3 && Likelihood > 4 && Likelihood <=5 , "HIGH" ,
Impact > 3 && Impact <= 4 && Likelihood > 0 && Likelihood <=3 , "MEDIUM" ,
Impact > 3 && Impact <= 4 && Likelihood > 3 && Likelihood <=5 , "HIGH" ,
Impact > 4 && Impact <= 5 && Likelihood > 0 && Likelihood <=1 , "MEDIUM" ,
Impact > 4 && Impact <= 5 && Likelihood > 1 && Likelihood <=5 , "HIGH" ,
"NA” )
2 REPLIES 2
Super User

Problem is about second quote in the formula for NA. In place of "NA” use "NA"

Hence following formula would work

``````Risk Level =
var Impact = AVERAGE(Output[RiskImpact])
var Likelihood = AVERAGE(Output[RiskLikelihood])
return
SWITCH(TRUE() ,
Impact > 0 && Impact <= 2 && Likelihood > 0 && Likelihood <=4 , "LOW" ,
Impact > 0 && Impact <= 2 && Likelihood > 4 && Likelihood <=5 , "MEDIUM" ,
Impact > 2 && Impact <= 3 && Likelihood > 0 && Likelihood <=4 , "MEDIUM" ,
Impact > 2 && Impact <= 3 && Likelihood > 4 && Likelihood <=5 , "HIGH" ,
Impact > 3 && Impact <= 4 && Likelihood > 0 && Likelihood <=3 , "MEDIUM" ,
Impact > 3 && Impact <= 4 && Likelihood > 3 && Likelihood <=5 , "HIGH" ,
Impact > 4 && Impact <= 5 && Likelihood > 0 && Likelihood <=1 , "MEDIUM" ,
Impact > 4 && Impact <= 5 && Likelihood > 1 && Likelihood <=5 , "HIGH",
"NA")``````

Helper I

Thank you Vijay. This is works.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors