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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
jonasgudm
Frequent Visitor

Multiplying measures together using sumx and group by columns

Hello I'm trying to build a measure which is a sumproduct of two measures using this data:

 

COMPYEARHIST

YEARMONTHSALEPRESDEPARTPRESASKHISTASKMONTHSALE
201620220620220618819872392
201620220620220821120898921
2016202206202207213209113555
201720220620220618822072392
201720220620220821123398921
2017202206202207213234113555
2016202207202208211208104539
201620220720220721320974069
2017202207202208211233104539
201720220720220721323474069

 

I have then added 3 measures.

-ASKRatio which is a ratio between PRESASK AND HISTASK:

 

 

ASKRatio = 
CALCULATE(
    DIVIDE(
        SUM(AdjustRatioNew[PRESASK]),
        SUM(AdjustRatioNew[HISTASK])
    ))

 

 

-MonthSaleTotal which is the sum of MONTHSALE for each COMPYEARHIST and YEARMONTHSALE

 

 

MonthSaleTotal = 
CALCULATE(
    sum(AdjustRatioNew[MONTHSALE]),
    ALLSELECTED(AdjustRatioNew[PRESDEPART])
    )

 

 


-SaleRatio which is a ratio between each MONTHASLE and TotalSalesMonth

 

 

SaleRatio = sum(AdjustRatioNew[MONTHSALE])/[MonthSaleTotal]

 

 


Then what I'm missing is a sumproduct called ASKSaleAdj between ASKRATIO and SaleRatio for each YearMonthSale and COMPYEARHIST, basically ending in this:

COMPYEARHISTYEARMONTHSALEPRESDEPARTPRESASKHISTASKASKRatioMONTHSALETotalSaleMonthSaleRatioASKSaleAdjust
20162022062022061881980,95723922848680,25 
20162022062022082112081,01989212848680,35 
20162022062022072132091,021135552848680,401,00
20172022062022061882200,84723922848680,25 
20172022062022082112330,91989212848680,35 
20172022062022072132340,911135552848680,400,89
20162022072022082112081,011045391786080,59 
20162022072022072132091,02740691786080,411,02
20172022072022082112330,911045391786080,59 
20172022072022072132340,91740691786080,410,91

So basically to sumproduct for the ASKSaleAdjust = 0,89 for compyearhist = 2017 and yearmonthsale = 202206 we do:
0,84*0,25+ 0,91*0,35+0,91*0,4 = 0,89

 

And could then be shrinked to this:

COMPYEARHISTYEARMONTHSALEASKSaleAdj
20162022061,00
20172022060,89
20162022071,02
20172022070,91


If you could show me how to do the formula for the measure ASKSaleAdj or have another method, that would mean the world to me 🙂 

2 REPLIES 2
jonasgudm
Frequent Visitor

@v-mengzhu-msft , I have edited the post.
Hopefully it is more understandable now

v-mengzhu-msft
Community Support
Community Support

Hi @jonasgudm ,

 

I have something I don't understand, for example, the column "ASKSaleAdj" you need

vmengzhumsft_0-1663143467164.png

 

what kind of operation is used to find out his data?

 

Or do you already have the data for this column and just don't understand how to  shrinked to be what you want?

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors