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
lluis
New Member

Media rapida multiplicacion

I'm new to PowerBI and now I have my first problem.
I have created an average that multiplies value by quantity but I do not want to perform the operation with the total values of the table.
The average is very simple.

Bajas Internas =
CALCULATE(SUM ('tabla1$Item'[Precio Coste medio ]) * SUM ('tabla2$Item Ledger Entry'[Quantity])* -1)

                    precio coste medio                     quantity                  Bajas internas

                              5                                            -1                               5

                              0.75                                       -100                           75

                               3                                           -100                           300

              ------------------------------------------------------------------------------

                  total     8.75                                      -201                           1758.75

I need the total to be the sum of internal losses and not the multiplication of the totals ...

 

I hope you can help me

 

1 ACCEPTED SOLUTION

You can solve the problem by creating a new calculated column, using:

 Bajas Internas = 'tabla1$Item Ledger Entry'[Quantity]*RELATED('tabla1$Item'[Precio Coste medio)
 
See you later

 

View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @lluis ,

 

I'm assuming that you have some other column on your table that makes a identification of each line correct try to do the following measure:

Bajas Internas =
VAR Bajas_Internas =
    CALCULATE (
        SUM ( 'tabla1$Item'[Precio Coste medio ] )
            * SUM ( 'tabla2$Item Ledger Entry'[Quantity] ) * -1
    )
RETURN
    IF (
        HASONEFILTER ( 'tabla1$Item'[Column] );
        Bajas_Internas;
        SUMX ( ALLSELECTED ( 'tabla1$Item'[Column] ); Bajas_Internas )
    )

Replace the Column by the name of the column you are using to identify each line.

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you very much for answering

You can solve the problem by creating a new calculated column, using:

 Bajas Internas = 'tabla1$Item Ledger Entry'[Quantity]*RELATED('tabla1$Item'[Precio Coste medio)
 
See you later

 

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.