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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
bilalkhokar73
Helper IV
Helper IV

Switch DAX showing wrong results

Hi, It seems its givign me still worng results
need your help what i am missing,
I need if my achvd% between 0 to 4 then Cvalue shoudl give me 0
IF Achvd % between 0.4 to 0.6 theen 60 like that , achvd% data type i made % , 
can someone help me what is worng
Thsi is my formula 

cvalues = SWITCH(TRUE(),
AND([achvd%]>=0.0,[achvd%]<=0.4),"0",
AND([achvd%]>0.4,[achvd%]<=0.6),"60",
AND([achvd%]>0.61,[achvd%]<=0.70),"70",
AND([achvd%]>0.71,[achvd%]<=0.80),"80",
AND([achvd%]>0.81,[achvd%]<=0.9),"90",
AND([achvd%]>0.91,[achvd%]<=1),"100",
AND([achvd%]>1.1,[achvd%]<=9.9),"125.5",
AND([achvd%]>14,[achvd%]<=100),"14100",
"0")
bilalkhokar73_0-1627358234092.png

 



6 REPLIES 6
Anonymous
Not applicable

Hi  @bilalkhokar73 ,

You can convert it to measure.

1. Create measure.、

Measure =
SWITCH(
   TRUE(),
   AND([achvd%]>=0.000001,[achvd%]<=0.0999999),"001111",
   AND([achvd%]>=0,[achvd%]<=0.4),"0",
   AND([achvd%]>0.41,[achvd%]<=0.6),"60",
   AND([achvd%]>0.61,[achvd%]<=0.7),"70",
   AND([achvd%]>0.71,[achvd%]<=0.8),"80",
   AND([achvd%]>0.81,[achvd%]<=0.9),"90",
   AND([achvd%]>0.91,[achvd%]<=1),"100",
   AND([achvd%]>1.1,[achvd%]<=9.9),"125.5",
   AND([achvd%]>14,[achvd%]<=100),"14100",
   "0")

2. Result:

vyangliumsft_0-1627540214106.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

VahidDM
Super User
Super User

Hi @bilalkhokar73 

 

I'm not sure I understand your question well or not, but please try the below measure:

cvalues = SWITCH(TRUE(),
AND(max('Table'[achvd%])>=0.0,max('Table'[achvd%])<=0.4),"0",
AND(max('Table'[achvd%])>0.4,max('Table'[achvd%])<=0.6),"60",
AND(max('Table'[achvd%])>0.61,max('Table'[achvd%])<=0.70),"70",
AND(max('Table'[achvd%])>0.71,max('Table'[achvd%])<=0.80),"80",
AND(max('Table'[achvd%])>0.81,max('Table'[achvd%])<=0.9),"90",
AND(max('Table'[achvd%])>0.91,max('Table'[achvd%])<=1),"100",
AND(max('Table'[achvd%])>1.1,max('Table'[achvd%])<=9.9),"125.5",
AND(max('Table'[achvd%])>14,max('Table'[achvd%])<=100),"14100",
"0")

the result would be as follow:

VahidDM_1-1627361953661.png

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos VahidDM_0-1627361917161.png !!

@VahidDM 
thsi erro came, my achvd% is measure here

bilalkhokar73_0-1627363297725.png

 

amitchandak
Super User
Super User

@bilalkhokar73 , measure seem correct. But make sure that achvd% is percent measure (marked as % in measure tool) . And these values are below 1 and shown as *100.

 

If not logic has to change

 

Try like this

cvalues = SWITCH(TRUE(),
,[achvd%]<=0.4,"0",
[achvd%]<=0.6,"60",
[achvd%]<=0.70,"70",
[achvd%]<=0.80,"80",
[achvd%]<=0.9,"90",
[achvd%]<=1,"100",
[achvd%]<=9.9,"125.5",
[achvd%]<=100,"14100",
"0")

 

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi amit thsi is my power bi link

 

https://www.dropbox.com/s/7zct41wc47xudt9/test.pbix?dl=0

this is my file here achvd% is coming wrong,  I need one more new column name that will be  achvd% divided by  100 as a new column
@amitchandak 

@amitchandak 

Still same, my achvd% is measure and it is % 

bilalkhokar73_1-1627363704794.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors