Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

total acumulado basado en la selección del mes

Tengo datos mes base , si selecciono septiembre necesito suma de enero a septiembre

He creado la tabla de calender, he probado muchas medidas pero no puedo obtener el valor correcto,

datos de muestra

Capture.JPG

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hola, @RajeshRanganath

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

b1.png

Puede crear una columna calculada como se muestra a continuación.

Month Year = YEAR([Date])*100+MONTH([Date])

MY (una tabla calculada):

MY = DISTINCT('Table'[Month Year])

No hay ninguna relación entre dos tablas. Puede crear una medida como se indica a continuación.

Result = 
IF(
    HASONEVALUE(MY[Month Year]),
    CALCULATE(
        SUM('Table'[ACT YTD]),
        FILTER(
            ALL('Table'),
            'Table'[KPI]=SELECTEDVALUE('Table'[KPI])&&
            'Table'[Month Year]<=SELECTEDVALUE(MY[Month Year])&&
            YEAR('Table'[Date])=INT(DIVIDE(SELECTEDVALUE(MY[Month Year]),100))
            
        )
    )  
)

Resultado:

b2.png

b3.png

Best Regard

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hola

Esta medida debería funcionar

•calculate([act ytd],datesytd(calendar[date],"31/12"))

A su vsisual, arrastre Año y Mes desde la tabla Calendario. Seleccione cualquier año/mes.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-alq-msft
Community Support
Community Support

Hola, @RajeshRanganath

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

b1.png

Puede crear una columna calculada como se muestra a continuación.

Month Year = YEAR([Date])*100+MONTH([Date])

MY (una tabla calculada):

MY = DISTINCT('Table'[Month Year])

No hay ninguna relación entre dos tablas. Puede crear una medida como se indica a continuación.

Result = 
IF(
    HASONEVALUE(MY[Month Year]),
    CALCULATE(
        SUM('Table'[ACT YTD]),
        FILTER(
            ALL('Table'),
            'Table'[KPI]=SELECTEDVALUE('Table'[KPI])&&
            'Table'[Month Year]<=SELECTEDVALUE(MY[Month Year])&&
            YEAR('Table'[Date])=INT(DIVIDE(SELECTEDVALUE(MY[Month Year]),100))
            
        )
    )  
)

Resultado:

b2.png

b3.png

Best Regard

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

CNENFRNL
Community Champion
Community Champion

@RajeshRanganath ¿Qué tal TOTALYTD func?


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!

Anonymous
Not applicable

@CNENFRNL

He intentado

Medida: TOTALYTD(SUM('table'[ACT YTD]), 'table'[Month year],ALL('table'))
Estoy obteniendo el mismo valor
Capture.JPG

@RajeshRanganath

Me pregunto por qué usa ALL('table') como el 3er parámetro en la fórmula; entonces su fórmula corresponde a

CALCULATE (
    SUM('table'[ACT YTD]),
    DATESYTD ( 'table'[Month year] ),
    ALL ( 'table' )
)

ALL('table') elimina todos los filtros en 'tabla', lo que da como resultado un cálculo incorrecto.

Por cierto, puede utilizar una medida de este tipo para mostrar las fechas utilizadas en el cálculo después de una selección de mes.

Debug =
MINX ( DATESYTD ( 'table'[Date] ), 'table'[Date] ) & " to "
    & MAXX ( DATESYTD ( 'table'[Date] ), 'table'[Date] )

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!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.