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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

How to multiply two filtred values in one column and then sum them together

I have the following data:

 

IDLocationMetric Value
1APopulation1000
2AAverage Income50000
3BPopulation2000
4BAverage Income30000
5CPopulation5000
6CAverage Income20000

 

How do I get the following result:

 

sum(Value of Population * Value of Average Income) / sum(Value of Population)

 

So when I select locations A and B, it should calculate each location's Value of Population * Value of Average Income then sum them together.

 

Thanks.

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

Sum PXAV = 
VAR _A =
    SUMMARIZE (
        'Table',
        'Table'[Location],
        "PXAI",
            CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Metric ] = "Population" )
                * CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Metric ] = "Average Income" )
    )
RETURN
    SUMX ( _A, [PXAI] )

 

Output:

VahidDM_0-1636596515909.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!


LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

Sum PXAV = 
VAR _A =
    SUMMARIZE (
        'Table',
        'Table'[Location],
        "PXAI",
            CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Metric ] = "Population" )
                * CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Metric ] = "Average Income" )
    )
RETURN
    SUMX ( _A, [PXAI] )

 

Output:

VahidDM_0-1636596515909.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!


LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Anonymous
Not applicable

Thank you, this is exactly what I need.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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