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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cecitorresHF
Helper I
Helper I

Sumar categorias

Hola 

 

Estoy trabajando con Power BI para crear un estado de perdidas y ganancias, en mi base de datos tengo el listado de las cuentas y el monto de cada una, sin embargo para calcular el margen de ganancia le tengo q restar a las ventas el costo de ventas y posteriormente el resto de gasto, alguien sabe como puedo sumar estas categorias(o restar) para poder generar el margen de utilidad?pic.png

 

 

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

Hi,

 

According to your description, I create a table to test:

91.png

Please take following steps:

1)Create a measure to calculate each Account and Branch’s profit rate:

Profit Rate =

DIVIDE (

    CALCULATE (

        MAX ( 'Profit'[Money] ),

        FILTER ( 'Profit', 'Profit'[Gral.Account] = "Sales" )

    )

        - CALCULATE (

            MAX ( 'Profit'[Money] ),

            FILTER ( 'Profit', 'Profit'[Gral.Account] = "Cost of Sales" )

        )

        - CALCULATE (

            MAX ( 'Profit'[Money] ),

            FILTER ( 'Profit', 'Profit'[Gral.Account] = "Staff Expenses" )

        ),

    CALCULATE (

        MAX ( 'Profit'[Money] ),

        FILTER ( 'Profit', 'Profit'[Gral.Account] = "Sales" )

    )

)

2)Create a measure to check Loss or Profit:

Loss/Profit Status = IF(Profit[Profit rate]<0,"Loss","Profit")

3)The result shows:

92.png

Here is my test pbix file:

pbix 

By the way, please post a reply in English so we can understand the issue better.

 

Best Regards,

Giotto Zhi

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, I create a table to test:

91.png

Please take following steps:

1)Create a measure to calculate each Account and Branch’s profit rate:

Profit Rate =

DIVIDE (

    CALCULATE (

        MAX ( 'Profit'[Money] ),

        FILTER ( 'Profit', 'Profit'[Gral.Account] = "Sales" )

    )

        - CALCULATE (

            MAX ( 'Profit'[Money] ),

            FILTER ( 'Profit', 'Profit'[Gral.Account] = "Cost of Sales" )

        )

        - CALCULATE (

            MAX ( 'Profit'[Money] ),

            FILTER ( 'Profit', 'Profit'[Gral.Account] = "Staff Expenses" )

        ),

    CALCULATE (

        MAX ( 'Profit'[Money] ),

        FILTER ( 'Profit', 'Profit'[Gral.Account] = "Sales" )

    )

)

2)Create a measure to check Loss or Profit:

Loss/Profit Status = IF(Profit[Profit rate]<0,"Loss","Profit")

3)The result shows:

92.png

Here is my test pbix file:

pbix 

By the way, please post a reply in English so we can understand the issue better.

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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