We'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
Hola a todos.
Tengo esta selección en SQL:
Solved! Go to Solution.
@joaovb96 Medida DAX
Measure = --direct translation
CALCULATE (
SUM ( 'COD_SITUAC'[VL_SALDO] ),
FILTER (
'COD_SITUAC',
NOT 'COD_SITUAC'[COD_SITUAC]
IN { 2, 7, 8 }
&& COALESCE ( 'COD_SITUAC'[CH_ATIVO], "T" ) = "T"
&& 'COD_SITUAC'[DT_VENCIM] < TODAY ()
)
)
Measure = --optimized
CALCULATE (
SUM ( 'COD_SITUAC'[VL_SALDO] ),
FILTER (
'COD_SITUAC',
NOT 'COD_SITUAC'[COD_SITUAC]
IN { 2, 7, 8 }
&& 'COD_SITUAC'[CH_ATIVO] = "T"
&& 'COD_SITUAC'[DT_VENCIM] < TODAY ()
)
)
@Greg_Deckler de @Pragati11 HI
Gracias por responder. (perdón por mi mal inglish)
Sí, todas las columnas provienen de la misma tabla
Traté de ejecutar como me dijeron anteriormente, pero no funcionó, intenté cambiar la 'T' a True y luego cambié la columna a True/ False pero tampoco funcionó.
Trataré de explicar antes de eso lo que sería este SELECT.
SELECT tiene como objetivo mostrar las cuentas por cobrar que están vencidas.
seleccione sum(VL_SALDO) de RECEIVE r
(esta línea sumará la cantidad a recibir)
donde no r.COD_SITUAC no en ('2', '7', '8') y coalesce(r.CH_ACTIVE, 'T') = 'T'
(Esta línea solo filtrará las cuentas por cobrar que no tengan el código 2,7,8 y también deben tener el código T de TRUE
y r.DT_VENCIM < current_date
(y esto quiere decir que la fecha de la cuenta por cobrar tiene que ser menor que la fecha actual, por lo tanto, es tardía)
@joaovb96 Medida DAX
Measure = --direct translation
CALCULATE (
SUM ( 'COD_SITUAC'[VL_SALDO] ),
FILTER (
'COD_SITUAC',
NOT 'COD_SITUAC'[COD_SITUAC]
IN { 2, 7, 8 }
&& COALESCE ( 'COD_SITUAC'[CH_ATIVO], "T" ) = "T"
&& 'COD_SITUAC'[DT_VENCIM] < TODAY ()
)
)
Measure = --optimized
CALCULATE (
SUM ( 'COD_SITUAC'[VL_SALDO] ),
FILTER (
'COD_SITUAC',
NOT 'COD_SITUAC'[COD_SITUAC]
IN { 2, 7, 8 }
&& 'COD_SITUAC'[CH_ATIVO] = "T"
&& 'COD_SITUAC'[DT_VENCIM] < TODAY ()
)
)
Hay @smpa01,
desafortunadamente no funcionó para mí, ¿habría alguna otra forma de tratar de evitarlo?
Transformé su medida de la siguiente manera:
Medida = --optimizado
CALCULAR (
SUM (f_RECEIVE[VL_BALANCE]),
FILTRO (
f_RECEIVE,
NO f_RECEBER[COD_SITUAC]
IN {2, 7, 8}
&& f_RECEBER[CH_ACTIVE] = "T"
&& f_RECEBER[DT_VENCIM] < HOY ()
)
)
Esta medida me devuelve el valor: 1.396.371,23
El valor que esperaba es: 3,326,100.87
HI @joaovb96 ,
¿Puede compartir algunos datos de muestra aquí, por favor?
Supongo que todas las columnas de la consulta SQL anterior provienen de la misma tabla.
Puede convertir fácilmente esta consulta SQL en DAX. Algo como lo siguiente:
totalAmount =
VAR defVal = "T"
VAR mainVal =
SELECTEDVALUE ( yourtablename[CH_ATIVO] )
RETURN
CALCULATE (
SUM ( yourtablename[VL_SALDO] ),
FILTER (
yourtablename,
NOT ( yourtablename[COD_SITUAC] )IN { '2', '7', '8' }
&& COALESCE ( mainVal, defVal )
&& yourtablename[DT_VENCIM] < TODAY ()
)
)
El DAX anterior se escribe basándose en mirar su consulta SQL. No puedo probarlo ya que no tengo acceso a sus datos.
Comparta algunos datos de muestra o un archivo pbix eliminando cualquier información confidencial para poder probar este DAX.
Gracias
Pragati
@joaovb96 Va a ser algo así como:
Measure =
CALCULATE(SUM('RECEBER'[VL_SALDO]),FILTER('RECEBER', [COD_SITUAC] NOT IN {2,7,8} && [DT_VENCIM] < TODAY() && [CH_ATIVO] = "T")
Por lo general, es mejor si solo publica datos de muestra y resultados esperados. Lo sentimos, si tiene problemas para seguir, ¿puede publicar datos de muestra como texto y salida esperada?
No hay realmente suficiente información para continuar, primero verifique si su problema es un problema común que se enumera aquí: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Además, consulte esta publicación sobre Cómo obtener respuestas rápidas a su pregunta: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Las partes más importantes son:
1. Datos de muestra como texto, use la herramienta de tabla en la barra de edición
2. Resultado esperado de los datos de la muestra
3. Explicación en palabras de cómo llegar desde 1. a 2.
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.