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
No estoy seguro de cómo crear esta instrucción IF Then, cualquier ayuda sería apreciada. Tengo dos variables que necesitan ser analizadas y una nueva columna creada.
Desea saber si se puede hacer mediante funciones DAX o el generador if then en el modo de consulta.
Fecha de la Fiscalía, Fecha de la Corte.
Si ambas variables están en blanco , Desconocido
Si la Fiscalía está en blanco y el tribunal tiene un valor de "Tribunal"
Si el Tribunal está en blanco y la Fiscalía tiene un valor "Prosec"
Si ambas variables tienen un valor " Court" o "Prosec" lo que tenga la fecha más reciente.
Solved! Go to Solution.
Hola @FLCrime
hay 2 opciones:
1. DAX usando SWITCH()
Column = SWITCH(TRUE(),
ISBLANK([Prosecution Date]) && ISBLANK([Court Date]), "Unknown",
ISBLANK([Prosecution Date]) && NOT(ISBLANK([Court Date])), "Court",
NOT(ISBLANK([Prosecution Date])) && ISBLANK([Court Date]), "Prosec",
[Prosecution Date]>[Court Date], "Prosec",
"Court"
)
2. Power QUery Custom Column
= if [Prosecution Date] = null and [Court Date] = null then "Unknown"
else if [Prosecution Date] = null and [Court Date] <> null then "Court"
else if [Prosecution Date] <> null and [Court Date] = null then "Prosec"
else if [Prosecution Date] > [Court Date] then "Prosec"
else "Court"
Pruebe una nueva columna como
Switch( true(),
isblank([Prosecution Date]) && isblank([Court Date]) ,"Unknown",
isblank([Prosecution Date]) && not(isblank([Court Date])),"Court",
not(isblank([Prosecution Date])) && (isblank([Court Date])),"Prosec",
max([Prosecution Date],[Court Date])
)
Hola @FLCrime
hay 2 opciones:
1. DAX usando SWITCH()
Column = SWITCH(TRUE(),
ISBLANK([Prosecution Date]) && ISBLANK([Court Date]), "Unknown",
ISBLANK([Prosecution Date]) && NOT(ISBLANK([Court Date])), "Court",
NOT(ISBLANK([Prosecution Date])) && ISBLANK([Court Date]), "Prosec",
[Prosecution Date]>[Court Date], "Prosec",
"Court"
)
2. Power QUery Custom Column
= if [Prosecution Date] = null and [Court Date] = null then "Unknown"
else if [Prosecution Date] = null and [Court Date] <> null then "Court"
else if [Prosecution Date] <> null and [Court Date] = null then "Prosec"
else if [Prosecution Date] > [Court Date] then "Prosec"
else "Court"
Soy bastante nuevo en Power Bi ¿"[]" indica una tabla? Todas mis variables son columnas en una tabla.
@FLCrime -
La documentación muestra una buena explicación de la sintaxis. https://docs.microsoft.com/en-us/dax/dax-syntax-reference.
Proud to be a Super User!
¡Muchas gracias! Esto ha sido muy útil.
¿Sabe cómo puedo usar esta nueva columna en una instrucción if then, pero usando una función DAX en su lugar? Como si el tribunal fuera de la corte, entonces [Declaración del Tribunal] si - Prosec entonces [Declaración de Prosec], de lo contrario desconocido.
Haría el si entonces en modo de consulta de energía, pero trabajando desde casa perdí el acceso al servidor y no puedo actualizar los datos. Así que no hay una consulta de energía para mí hoy.
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.