Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hola
Necesito ayuda con la validación de valores mediante DAX para determinar si solo contienen valores alfanuméricos .
Si el valor contiene solo valores alfanuméricos , debe devolver TRUE; de lo contrario, debería devolver FALSE.
| Valor |
| gtest@gmail.com |
| 16546854 |
| 464213 |
| 1641654 |
| 564646 |
| 646464 |
| 546498 |
| 46464 |
| 64646464 |
| 646486 |
| 64646546 |
| ASW4646464 |
| AW54646 |
| AQ464654 |
| AD446464 |
| AS4646DD |
| ASDSWSD |
| KLHH |
| OOOOOOOO |
| POJPOJP |
@InsightSeeker
Puede crear una columna calculada en la tabla como se muestra a continuación. ¡Siéntase libre de ajustar la fórmula o hacer más preguntas!
To handle blank values in your column and prevent GENERATESERIES from crashing, you can add a check for blank values in the VAR Length declaration and handle those cases appropriately
AlphanumericCheck =
VAR CurrentValue = 'YourTable'[YourColumn]
VAR Length = LEN(CurrentValue)
VAR CheckChar =
IF(
ISBLANK(CurrentValue),
0, // No characters to check, so treat as alphanumeric
SUMX(
GENERATESERIES(1, Length),
VAR CurrentChar = MID(CurrentValue, [Value], 1)
RETURN
IF(
NOT (
(UNICODE(CurrentChar) >= UNICODE("A") && UNICODE(CurrentChar) <= UNICODE("Z")) ||
(UNICODE(CurrentChar) >= UNICODE("a") && UNICODE(CurrentChar) <= UNICODE("z")) ||
(UNICODE(CurrentChar) >= UNICODE("0") && UNICODE(CurrentChar) <= UNICODE("9"))
),
1,
0
)
)
)
RETURN
IF(CheckChar > 0, FALSE, TRUE)
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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.