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.
Hola
Tengo una tabla que se parece a la siguiente:
Esta tabla está conectada con una tabla de fechas que tiene el número de mes RY. Abril tiene el número de mes RY n.o 1 y Mar tiene el mes RY 12. Quiero calcular la suma acumulada del valor de esos meses que aún no han desaparecido. Debe tener el siguiente aspecto:
Así que estoy creando medida algo como la siguiente:
Sin embargo, no produce el resultado deseado. ¿Alguien podría ayudarme dónde estoy cometiendo el error?
Enlace de archivo: https://1drv.ms/u/s!AucycxZHFe9TjUOV3GfsP_bL3FcC?e=LwTupY
Solved! Go to Solution.
@leo_89 , es posible que desee probar esta medida para lograr los valores deseados,
Cumulative measure =
VAR _CYMonth = MONTH ( TODAY () )
VAR _RYMonth = IF ( _CYMonth > 3, _CYMonth - 3, _CYMonth + 9 )
RETURN
SUMX (
FILTER (
ALL ( '5y average' ),
'5y average'[Month Number] <= MAX ( '5y average'[Month Number] )
&& '5y average'[Month Number] >= _RYMonth
),
CALCULATE ( SUM ( '5y average'[Value] ) )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hola
Puede descargar mi archivo PBI desde aquí.
Espero que esto ayude.
@Ashish_Mathur , He adjuntado el archivo ficticio en el post. Desafortunadamente, su cálculo no funcionó en mi archivo.
Hola
Su solución ni siquiera está remotamente cerca de lo que he sugerido. En el objeto visual, el nombre de Año y Mes debe arrastrarse desde la Tabla de calendario. Además, su medida acumulativa no está ni cerca de la mía. Por favor, estudie el archivo que he compartido con usted, con mucho cuidado.
Hola, @leo_89 , en cuanto a su medida, un error radica en el mal uso de la variable en esta parte, creo.
Var remain_month = SUM('Table'[Value])
Var remain_month_cum = SUMX(FILTER(ALL(Dates),Dates[RY Month Number]>=_RYMonth),remain_month)
De hecho, las variables en DAX NO SON TAN VARIABLE COMO se esperaba!
In DAX, variables are calculated within the scope in which they are written, and then the result of them is stored and used in the rest of the expression.
Es posible que desee consultar un artículo sobre este tema para obtener más detalles.
Sin un modelo de datos completo, es difícil depurar al máximo. Si adjunta un archivo ficticio con suficientes datos de maqueta, es mucho más fácil de solucionar.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@leo_89 , es posible que desee probar esta medida para lograr los valores deseados,
Cumulative measure =
VAR _CYMonth = MONTH ( TODAY () )
VAR _RYMonth = IF ( _CYMonth > 3, _CYMonth - 3, _CYMonth + 9 )
RETURN
SUMX (
FILTER (
ALL ( '5y average' ),
'5y average'[Month Number] <= MAX ( '5y average'[Month Number] )
&& '5y average'[Month Number] >= _RYMonth
),
CALCULATE ( SUM ( '5y average'[Value] ) )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |