Skip to main content
cancel
Showing results for 
Search instead 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

Reply
Bansi008
Helper II
Helper II

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
Vijay_A_Verma
Super User
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")

 

Thank you Vijay. This is works.

Helpful resources

Announcements
Europe Fabric Conference

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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors