Forum Discussion
SWITCH function for changing UNICODE values not working correctly.
- 4 years ago
This appears to be working now. I did two things.
1. I moved it to a measure.
2. I changed the code, adding the MAX function.FCMES = VAR WUCL=UNICHAR(128531) VAR UCL=UNICHAR(128530) VAR sigma=UNICHAR(128532) VAR good=UNICHAR(128513) VAR UCLV=0.875 VAR WUCLV=0.625 VAR sigmaV=0.5 Var goodV=0.3 VAR SWITCHER= Switch(TRUE(), Max('Example Data'[Value])>=UCLV,UCL, MAX('Example Data'[Value])>=WUCLV,WUCL, Max('Example Data'[Value])>=sigmaV,sigma,good) Return SWITCHER
UNICODE , You need to create this face change measure on the measure, I doubt you are creating a column based on column
example
Switch(TRUE(),
sum('Example Data'[Value]) >=UCLV,UCL,
sum('Example Data'[Value])>=WUCLV,WUCL,
sum('Example Data'[Value])>=sigmaV,sigma,good)
- UNICODE4 years agoHelper I
This appears to be working now. I did two things.
1. I moved it to a measure.
2. I changed the code, adding the MAX function.FCMES = VAR WUCL=UNICHAR(128531) VAR UCL=UNICHAR(128530) VAR sigma=UNICHAR(128532) VAR good=UNICHAR(128513) VAR UCLV=0.875 VAR WUCLV=0.625 VAR sigmaV=0.5 Var goodV=0.3 VAR SWITCHER= Switch(TRUE(), Max('Example Data'[Value])>=UCLV,UCL, MAX('Example Data'[Value])>=WUCLV,WUCL, Max('Example Data'[Value])>=sigmaV,sigma,good) Return SWITCHER - UNICODE4 years agoHelper I
Initially I had did this as a calculated column.
Using the Sum makes sense to conver it over to a measure, ie it needing a single value to compute. The problem with using SUM is it starts adding the Example Data'[Value] together and gives the incorrect results.
MIN returns the UNICODE with the smallest code value.
MAX always returns the one with the largest code value