Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to do Excel Sumif in PowerBI?

Hello,

Suppose I have the following (made up) data below:

 
1BCDEFGHI
2StockAmount InvestedLow Projected ValueLow RankMid Projected ValueMid RankHigh Projected ValueHigh Rank
3Amazon$34,376.00$103,128.00Better$154,692.00Good$206,256.00Better
4Tesla$85,544.00$256,632.00Best$384,948.00Best$513,264.00Best
5Microsoft$45,333.00$226,665.00Best$339,997.50Best$453,330.00Best
6Google$40,473.00$121,419.00Better$182,128.50Good$242,838.00Better
7Amazon$91,208.00$91,208.00Better$136,812.00Better$182,416.00Better
8Netflix$9,027.00$9,027.00Bad$13,540.50Bad$18,054.00Bad
9Spotify$35,476.00$70,952.00Good$106,428.00Better$141,904.00Good
10Uber$24,444.00$24,444.00Bad$36,666.00Bad$48,888.00Bad
 

 

My goal is to create this table, where it aggregates the low, mid, and high values based on the rank.

 Low Projected ValueMid Projected ValueHigh Projected Value
Bad$33,471.00$50,206.50$66,942.00
Good$70,952.00$336,820.50$141,904.00
Better$315,755.00$243,240.00$631,510.00
Best$483,297.00$724,945.50$966,594.00

 

in Excel, it's easy. I would just do this:

 

 BCDE
  Low Projected ValueMid Projected ValueHigh Projected Value
15Bad=SUMIF($E$3:$E$10,B15,$D$3:$D$10)=SUMIF($G$3:$G$10,B15,$F$3:$F$10)=SUMIF($I$3:$I$10,B15,$H$3:$H$10)
16Good=SUMIF($E$3:$E$10,B16,$D$3:$D$10)=SUMIF($G$3:$G$10,B16,$F$3:$F$10)=SUMIF($I$3:$I$10,B16,$H$3:$H$10)
17Better=SUMIF($E$3:$E$10,B17,$D$3:$D$10)=SUMIF($G$3:$G$10,B17,$F$3:$F$10)=SUMIF($I$3:$I$10,B17,$H$3:$H$10)
18Best=SUMIF($E$3:$E$10,B18,$D$3:$D$10)=SUMIF($G$3:$G$10,B18,$F$3:$F$10)=SUMIF($I$3:$I$10,B18,$H$3:$H$10)

 

 

So the sumif for the low, mid, and high values are going off of the low, mid, and high ranks, respectively. The output table is not just off of one column, but will need to be three columns. However, I am struggling to get all these calculations in one table in PowerBI. I've tried putting this in the matrix visual, but this only lets me pivot off of one column. I've tried writing some measures in DAX, but I couldn't get that either. 

 

Thanks!

 

Edit:

Clarity in the output table

 

8 Replies

  • Anonymous I haven't used SUMIF but what is B15,B16,B17,B18 values which are used in SUMIF formula you provided.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k , yes, I apologize, it is unclear. The output table I made for B15 to B18 is supposed to refer to the values Bad to Best at the left of the table. The sumif formula is referencing those words as the criteria in the criteria range of the sumif formula. 

       

       BCDE
        Low Projected ValueMid Projected ValueHigh Projected Value
      15Bad=SUMIF($E$3:$E$10,B15,$D$3:$D$10)=SUMIF($G$3:$G$10,B15,$F$3:$F$10)=SUMIF($I$3:$I$10,B15,$H$3:$H$10)
      16Good=SUMIF($E$3:$E$10,B16,$D$3:$D$10)=SUMIF($G$3:$G$10,B16,$F$3:$F$10)=SUMIF($I$3:$I$10,B16,$H$3:$H$10)
      17Better=SUMIF($E$3:$E$10,B17,$D$3:$D$10)=SUMIF($G$3:$G$10,B17,$F$3:$F$10)=SUMIF($I$3:$I$10,B17,$H$3:$H$10)
      18Best=SUMIF($E$3:$E$10,B18,$D$3:$D$10)=SUMIF($G$3:$G$10,B18,$F$3:$F$10)=SUMIF($I$3:$I$10,B18,$H$3:$H$10)
      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Anonymous see attached, look at table GoodBad and Rank, and all the efforts are in data prep, following the best practice with scalable solution.

         

        Ignore other tables in the file, those for not in use.

         

        I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

         

         

  • Hi Anonymous,

    In this case the best option is to unpivot all columns for project amount and rank
    Then create a matrix visualization with

    rank on rows
    Project type on columns
    Project value on values.

    Should give you expected amounts