Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.