Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
It`s a challenge for me to find a simple way to fix a input numbers.
In this scenario there are a lot wrong inputs the cases are :
(view: in the same column and different rows)
the result expected is:
- 13 characters (only numbers) for cellphones without spaces
ex: CCcc9NNNNNNNN (CC is Country Code, cc is city Code, 9 is a new add number for cellphone started, NNNNNNNN Number)
- 12 characters (only numbers) for Landline phone without spaces
Steps
Somebody knows to coding this ?
Thanks for the help!
I Write this Code:
Fixed Phone =
VAR phone = [customer_contact]
VAR LenContact = LEN(phone)
VAR Num8dig = LEFT(RIGHT(phone;8);1)
VAR CountryCode = 55
VAR CityCode = 22
RETURN
SWITCH(True();
LenContact<8;phone;
LenContact=8&&Num8dig in {"7";"6";"5";"4";"3";"2";"1";"0"}; CountryCode & CityCode & phone;
LenContact=8&&Num8dig in {"9";"8"}; CountryCode & CityCode &"9"☎
LenContact=9&&Num8dig in {"9";"8"}; CountryCode & CityCode & phone;
LenContact=10&&Num8dig in {"7";"6";"5";"4";"3";"2";"1";"0"};CountryCode & phone;
LenContact=10&&Num8dig in {"9";"8"}; CountryCode & LEFT(phone;2)&"9"& RIGHT(phone;8);
LenContact=12&&Num8dig in {"7";"6";"5";"4";"3";"2";"1";"0"}||LenContact=13;phone;
LenContact=12&&Num8dig in {"9";"8"}; LEFT(phone;4)&"9"& RIGHT(phone;8);
LenContact=13;phone;
LenContact>13&&Num8dig in {"9";"8"};RIGHT(phone;13);
LenContact>13&&Num8dig in {"7";"6";"5";"4";"3";"2";"1";"0"};RIGHT(phone;12)
;0)
but:
"Expressions that generate variable data type can not be used to define calculated columns."
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 38 | |
| 37 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 65 | |
| 39 | |
| 33 | |
| 23 |