Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hola a todos,
¿Te va bien?
Estoy escribiendo para obtener una ayuda con un código, estaba tratando de crear una medida caluculada con múltiples filtros usando variables, sin embargo, la fórmula seguía generando valor ZERO. Me assueme el problema se debe a los archivadores. ¿Puede aconsejar, por favor?
gracias
Under process WS Grant =
VAR
UnderProcessFilter =
FILTER('TWS Wage Subsidy','TWS Wage Subsidy'[Workflow Status (groups)] = "Under Process"
&& 'TWS Wage Subsidy'[Status] = "Active"
&& (
RELATED('TWS Employee Application'[Workflow Status] ) <> "Sent Back to Portal"
&& RELATED( 'TWS Employee Application'[Workflow Status]) <> "Created - Not Submitted"
)
&& RELATED('TWS Employee Application'[Monitoring Status]) <> "Flagged")
VAR
Diploma = FILTER('TWS Wage Subsidy','TWS Wage Subsidy'[Segment Reference (groups)] = "MoL Segment - Diploma")
RETURN
CALCULATE (
SUMX (
'TWS Wage Subsidy',
IF (
'TWS Wage Subsidy'[Current Wage] * 12 * 0.7 > 8400,
8400,
'TWS Wage Subsidy'[Current Wage] * 12 * 0.7
)
)
+ SUMX (
'TWS Wage Subsidy',
IF (
'TWS Wage Subsidy'[Current Wage] * 6 * 0.5 > 4200,
4200,
'TWS Wage Subsidy'[Current Wage] * 6 * 0.5
)
), Diploma,UnderProcessFilter)
Solved! Go to Solution.
No @salafoo,
Trato de simplificar su fórmula y combinar estas condiciones, puede intentar utilizar las siguientes expresiones si funciona de su lado.
Under process WS Grant =
VAR UnderProcessFilter =
CALCULATETABLE (
'TWS Wage Subsidy',
FILTER (
ALLSELECTED ( 'TWS Wage Subsidy' ),
[Segment Reference (groups)] = "MoL Segment - Diploma"
&& [Workflow Status (groups)] = "Under Process"
&& [Status] = "Active"
),
FILTER (
ALLSELECTED ( 'TWS Employee Application' ),
NOT ( [Workflow Status] IN { "Sent Back to Portal", "Created - Not Submitted" } )
&& [Monitoring Status] <> "Flagged"
)
)
RETURN
SUMX (
UnderProcessFilter,
MIN ( [Current Wage] * 12 * 0.7, 8400 )
+ MIN ( [Current Wage] * 6 * 0.5, 4200 )
)
saludos
Xiaoxin Sheng
No hay @salafoo
Si la fórmula no devuelve un error significa que su DAX es correcto. Sin embargo, no podemos detectar de dónde viene el cero sin compartir con nosotros más detalles o un archivo sample of Pbix.
Recomendaría que después de la DEVOLUCIÓN de su fórmula comprobar lo que cada variable está regresando como resultado, también comprobar esos SUMX uno por uno hasta que determine de dónde viene el CERO.
Buena suerte
Gracias Amine por resopnse, El propleme cuando creo la fórmula sin variables funciona, pero cuando se codifica como lo anterior genera ceros sin error de código. A continuación se muestra la fórmula antigua:
Under process WS Grant =
CALCULATE (
SUMX (
'TWS Wage Subsidy',
IF (
'TWS Wage Subsidy'[Current Wage] * 12 * 0.7 > 8400,
8400,
'TWS Wage Subsidy'[Current Wage] * 12 * 0.7
)
)
+ SUMX (
'TWS Wage Subsidy',
IF (
'TWS Wage Subsidy'[Current Wage] * 6 * 0.5 > 4200,
4200,
'TWS Wage Subsidy'[Current Wage] * 6 * 0.5
)
),
FILTER (
'TWS Wage Subsidy',
'TWS Wage Subsidy'[Segment Reference (groups)] = "MoL Segment - Diploma"
),
'TWS Wage Subsidy'[Workflow Status (groups)] = "Under Process",
'TWS Wage Subsidy'[Status] = "Active",
( 'TWS Employee Application'[Workflow Status] <> "Sent Back to Portal"
&& 'TWS Employee Application'[Workflow Status] <> "Created - Not Submitted" ),
'TWS Employee Application'[Monitoring Status] <> "Flagged"
)
No @salafoo,
Trato de simplificar su fórmula y combinar estas condiciones, puede intentar utilizar las siguientes expresiones si funciona de su lado.
Under process WS Grant =
VAR UnderProcessFilter =
CALCULATETABLE (
'TWS Wage Subsidy',
FILTER (
ALLSELECTED ( 'TWS Wage Subsidy' ),
[Segment Reference (groups)] = "MoL Segment - Diploma"
&& [Workflow Status (groups)] = "Under Process"
&& [Status] = "Active"
),
FILTER (
ALLSELECTED ( 'TWS Employee Application' ),
NOT ( [Workflow Status] IN { "Sent Back to Portal", "Created - Not Submitted" } )
&& [Monitoring Status] <> "Flagged"
)
)
RETURN
SUMX (
UnderProcessFilter,
MIN ( [Current Wage] * 12 * 0.7, 8400 )
+ MIN ( [Current Wage] * 6 * 0.5, 4200 )
)
saludos
Xiaoxin Sheng
Sí veo, está utilizando variables como filtros dentro de la función CALCULATE.
No puede utilizar variables en el nivel de filtro de la función Calcular;
https://docs.microsoft.com/en-us/dax/calculate-function-dax
Entonces, ¿por qué no lo mantienes así?