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

Next 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

Reply
Syndicate_Admin
Administrator
Administrator

Validación de valores alfanuméricos mediante DAX en Power BI

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
3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

@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!

Verificación alfanumérica =
VAR CurrentValue = 'TuTabla'[TuColumna]
VAR Longitud = SOLAMENTE(Valor actual)
VAR CheckChar =
SUMX(
GENERATESERIES(1, Longitud),
VAR CurrentChar = MEDIO(CurrentValue, [Valor], 1)
DEVOLUCIÓN
SI(
NO (
(UNICODE(CurrentChar) >= UNICODE("A") && UNICODE(CurrentChar) <= UNICODE("Z")) ||
(UNICODE(CurrentChar) >= UNICODE("una") && UNICODE(CurrentChar) <= UNICODE("con")) ||
(UNICODE(CurrentChar) >= UNICODE("0") && UNICODE(CurrentChar) <= UNICODE("9"))
),
1,
0
)
)
DEVOLUCIÓN
SI(CheckChar > 0, FALSO, VERDADERO)

Hola @marcelsmaglhaes

Recibo el siguiente error cuando uso la sugerencia DAX anterior

InsightSeeker_0-1722612591304.png

Saludos

Gaurav

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)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Kudoed Authors