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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_Aleksa_
Helper II
Helper II

Error de fórmula de conmutación

Hola

Estoy usando la fórmula switch y estoy recibiendo el siguiente error:

"No se puede determinar un valor único para la columna "Pmt_Instruction_Cde"."

Estoy perplejo porque estoy usando exactamente los mismos criterios con sólo un número diferente de días en otra medida y funciona perfectamente bien allí.

Ind - SWITCH( TRUE(),
DERECHO('Datos semanales'[Pmt_Instruction_Cde],1)-"2" && 'Datos semanales'[Días a partir de la fecha del informe] >-0 && 'Datos semanales'[Días a partir de la fecha del informe] <31,"Todos los estados vencidos",
DERECHO('Datos semanales'[Pmt_Instruction_Cde],1)-"2" && 'Datos semanales'[State]'"CA" && 'Datos semanales'[Días a partir de la fecha del informe] > 90, "Atrasado",
DERECHO('Datos semanales'[Pmt_Instruction_Cde],1)-"2" && 'Datos semanales'[Estado]'"OR" && 'Datos semanales'[Días a partir de la fecha del informe] > 60, "Or Vencido",
""
)
¡¡Gracias!!
2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

@_Aleksa_

si necesita una medida tratar

 Ind = 
var _Pmt_Instruction_Cde = MAX('Weekly Data'[Pmt_Instruction_Cde])
var _Days = MAX('Weekly Data'[Days from Report Date])
var _State = MAX('Weekly Data'[State]) 

RETURN

SWITCH( TRUE(),
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _Days  >=0 && _Days  <31, "All States Overdue",
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _State ="CA" && _Days  >=90,"Overdue",
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _State ="OR" && _Days  >=60,"OR Overdue",
""
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

@_Aleksa_

Prueba esto

Ind =
SWITCH (
    TRUE (),
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[Days from Report Date] = 0
        && 'Weekly Data'[Days from Report Date] < 31, "All States Overdue",
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[State] = "CA"
        && 'Weekly Data'[Days from Report Date] >= 90, "Overdue",
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[State] = "OR"
        && 'Weekly Data'[Days from Report Date] >= 60, "OR Overdue",
    ""
)



¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Apreciar con un kudos
🙂


Regards,
Nandu Krishna

View solution in original post

9 REPLIES 9
TomMartens
Super User
Super User

Hola @_Aleksa_ ,

¿cuál es el contexto de la instrucción DAX, está creando

  • una columna calculada, o
  • una medida

Si va a crear una medida y no hay ningún contexto de fila que tenga que ajustar las referencias de columna dentro de una función de agregación como MAX.

Con suerte, esto proporciona algunos nuevos conocimientos y ayuda a abordar su desafío.

saludos

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Estaba creando una medida orginalmente.

Cuando intenté crear un solumn con la misma declaración que torpe sólo una tasa de resultadohr que 3 estaba destinado.

Además, cuando incorporo la función MAX me está dando otro mensaje de error diciendo:
"Demasiadas sentencias se pasaron a la función MAX."

Gracias por la ayuda!

az38
Community Champion
Community Champion

@_Aleksa_

si necesita una medida tratar

 Ind = 
var _Pmt_Instruction_Cde = MAX('Weekly Data'[Pmt_Instruction_Cde])
var _Days = MAX('Weekly Data'[Days from Report Date])
var _State = MAX('Weekly Data'[State]) 

RETURN

SWITCH( TRUE(),
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _Days  >=0 && _Days  <31, "All States Overdue",
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _State ="CA" && _Days  >=90,"Overdue",
RIGHT(_Pmt_Instruction_Cde, 1)="2" && _State ="OR" && _Days  >=60,"OR Overdue",
""
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Gracias, esto funcionó perfectamente para una medida!!

¿Woudl puedes proporcionar una opción para una columna?

¡Gracias!

@_Aleksa_

Prueba esto

Ind =
SWITCH (
    TRUE (),
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[Days from Report Date] = 0
        && 'Weekly Data'[Days from Report Date] < 31, "All States Overdue",
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[State] = "CA"
        && 'Weekly Data'[Days from Report Date] >= 90, "Overdue",
    RIGHT (
        'Weekly Data'[Pmt_Instruction_Cde],
        1
    ) = "2"
        && 'Weekly Data'[State] = "OR"
        && 'Weekly Data'[Days from Report Date] >= 60, "OR Overdue",
    ""
)



¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Apreciar con un kudos
🙂


Regards,
Nandu Krishna

¡¡¡¡Gracias!!!!

Hola @_Aleksa_ ,

Si la respuesta resolvió su problema, por favor considere aceptarlo como una solución.

Saludos

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hola @_Aleksa_ ,

No será necesario utilizar la función MAX() o SELECTEDVALUE() para crear la columna. Sólo tiene que utilizar su código orginal funcionará.

Saludos

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
az38
Community Champion
Community Champion

@_Aleksa_

¿Está seguro de que necesita una medida?

puede crear una columna con la misma instrucción o utilizar SELECTEDVALUE() como

SELECTEDVALUE('Datos semanales'[Pmt_Instruction_Cde])


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.