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

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.

Reply
yodha
Helper IV
Helper IV

¿Cómo calcular el costo de balanceo?

Hola

soy muy nuevo en power bi.

Tengo Matrix en mi .pbix así,

y quiero calcular el costo de rodadura, y el resultado final debería ser así,

Cualquier ayuda en esto es muy apreciada.

Gracias por adelantado.

2 ACCEPTED SOLUTIONS
VijayP
Super User
Super User

@yodha

Puede utilizar esta función para obtener la acumulativa.

Estoy compartiendo el PBIX que se puede descargar formulario aquí

Si encuentra esto como solución, mencione esto como solución y comparta sus Kudos.

También puedes ver mis Videos en www.youtube.com/perepavijay

saludos

Vijay Perepa

2020-04-27_131126.png




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


View solution in original post

v-yingjl
Community Support
Community Support

Hola @yodha ,

Puede seguir estos pasos para probar:

1. He creado una columna calculada a la columna de fecha fomat para un cálculo fácil:

Month-Year = VALUE(FORMAT('Table'[Date],"yyyymm"))​

2. He creado una medida para calcular el costo actual para reemplazar la columna anterior porque pensé que era contradictoria al calcular el costo total basado en el mes anterior:

Present cost measure =
VAR _minmonthyear =
    CALCULATE ( MIN ( 'Table'[Month-Year] ), ALLSELECTED ( 'Table' ) )
VAR _cmonthyear =
    SELECTEDVALUE ( 'Table'[Month-Year] )
VAR _lastmonthyear =
    CALCULATE (
        MAX ( 'Table'[Month-Year] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month-Year] < _cmonthyear )
    )
RETURN
    IF (
        _cmonthyear = _minmonthyear,
        SUM ( 'Table'[Present cost] ),
        CALCULATE (
            SUM ( 'Table'[Present cost] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Categoary] ),
                'Table'[Month-Year] = _minmonthyear
            )
        )
            - CALCULATE (
                SUM ( 'Table'[Forecast cost] ),
                FILTER (
                    ALLEXCEPT ( 'Table', 'Table'[Categoary] ),
                    'Table'[Month-Year] < _cmonthyear
                )
            )
    )
​

3. Por último, cree una medida para calcular el coste total:

Total cost = [Present cost measure]-SUM('Table'[Forecast cost])​

4. Obtendrá el resultado de la siguiente manera:roll cost.png

Aquí está mi archivo de muestra que espera ayudarle, por favor pruébelo: PBIX

Mejores looks,
Yingjie Li

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

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hola @yodha ,

Puede seguir estos pasos para probar:

1. He creado una columna calculada a la columna de fecha fomat para un cálculo fácil:

Month-Year = VALUE(FORMAT('Table'[Date],"yyyymm"))​

2. He creado una medida para calcular el costo actual para reemplazar la columna anterior porque pensé que era contradictoria al calcular el costo total basado en el mes anterior:

Present cost measure =
VAR _minmonthyear =
    CALCULATE ( MIN ( 'Table'[Month-Year] ), ALLSELECTED ( 'Table' ) )
VAR _cmonthyear =
    SELECTEDVALUE ( 'Table'[Month-Year] )
VAR _lastmonthyear =
    CALCULATE (
        MAX ( 'Table'[Month-Year] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month-Year] < _cmonthyear )
    )
RETURN
    IF (
        _cmonthyear = _minmonthyear,
        SUM ( 'Table'[Present cost] ),
        CALCULATE (
            SUM ( 'Table'[Present cost] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Categoary] ),
                'Table'[Month-Year] = _minmonthyear
            )
        )
            - CALCULATE (
                SUM ( 'Table'[Forecast cost] ),
                FILTER (
                    ALLEXCEPT ( 'Table', 'Table'[Categoary] ),
                    'Table'[Month-Year] < _cmonthyear
                )
            )
    )
​

3. Por último, cree una medida para calcular el coste total:

Total cost = [Present cost measure]-SUM('Table'[Forecast cost])​

4. Obtendrá el resultado de la siguiente manera:roll cost.png

Aquí está mi archivo de muestra que espera ayudarle, por favor pruébelo: PBIX

Mejores looks,
Yingjie Li

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

Greg_Deckler
Super User
Super User

https://community.powerbi.com/t5/Quick-Measures-Gallery/Rolling-Months/m-p/391499#M124

https://community.powerbi.com/t5/Quick-Measures-Gallery/Rolling-Weeks/m-p/391694#M128

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
VijayP
Super User
Super User

@yodha

Puede utilizar esta función para obtener la acumulativa.

Estoy compartiendo el PBIX que se puede descargar formulario aquí

Si encuentra esto como solución, mencione esto como solución y comparta sus Kudos.

También puedes ver mis Videos en www.youtube.com/perepavijay

saludos

Vijay Perepa

2020-04-27_131126.png




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.