# SUMIFS or SUMPRODUCT equivalent in PowerPivot



## L33 (Jul 1, 2014)

Trying to learn PowerPivot and I promise I won't be on here constantly with every little thing, but if someone could give me a pointer on this one I'd be very grateful...

This is so basic in standard Excel that I'm annoyed with myself I can't work it out in PowerPivot.. I've got a table of 4 items each repeated for 3 months... I've got a blank field there and I want to add the values found in a second table to this field. In standard Excel this would be simple SUMPRODUCT or SUMIFS formula.. I've tried to get to grips with SUMX but I've no idea where to start with it. (I'm very new to this, and I have a suspicion that the real answer to this problem has to do with mental shift and thinking about the problem in a different way, rather than simply trying to replicate what I'd do in normal Excel, but baby steps....)

The "Sum of Resolution Time" here is what I want to fill in (and here I've shown how it would look)

 ABC1SerialMonthSum of ResolutionTime2V410835Jan-1413.613V410835Feb-1416.634V410835Mar-1405V534111Jan-1406V534111Feb-1407V534111Mar-1408V718374Jan-1409V718374Feb-14010V718374Mar-1418.511V875849Jan-14012V875849Feb-14013V875849Mar-142.6

<tbody>

</tbody>
and I want to grab the values from the Resolution field here:

GHIJ1SerialDateMonthYrResolution2V41083509/01/2014Jan-142.493V41083518/01/2014Jan-149.494V41083527/01/2014Jan-141.635V41083519/02/2014Feb-149.056V41083527/02/2014Feb-145.27V41083528/02/2014Feb-142.388V71837401/03/2014Mar-142.889V71837403/03/2014Mar-149.5910V71837405/03/2014Mar-146.0311V87584928/03/2014Mar-142.6

<tbody>

</tbody>
Many thanks in advance for the assistance...


----------



## Tianbas (Jul 1, 2014)

Iam not sure if you really need a sumif or sumproduct for that. If you just use Serial and MonthYr in the rows of your pivot table and the sum of resolution in the value field you should see your target table

If you need something like a sumif the following formulas can help
as a calculated measure in a pivot table try =CALCULATE( SUM(TABLE[Resolution]),ALLEXCEPT(TABLE,TABLE[Serial])) 
as a calculated column in the data model try =CALCULATE( SUM(Table[Resolution]),FILTER(ALL(Table), Table[Serial]=EARLIER(Table[Serial])))

a sumproduct is more difficult...


----------



## L33 (Jul 1, 2014)

Thanks for the response. Just to clarify, the first table isn't the final output, it is another table in my data model that I _think _I need to populate. I can't get your data model formula to work though... 

To do what I'm trying to do in standard Excel is very simple: 
I have a list of Devices, listed as many times as there are Months in my report period (in my sample, 4 devices for each one of 3 months (Jan-March) ). 

Against each Device-Month row, I'd have a column that tells me the Potential Available hours - eg. 168 working hours in the month for it to potentially be required for. 

Then I'd get the Downtime for the Device-Month pairing which by getting the sum of any Resolution times against that Device in that Month, retrieved from that other table (the Service table). Another column simply deducts "DownTime (aka sum of Resolution time)" from the "Potential Available" to give me the Uptime hours.

I need an output that displays per Month the Uptime % across the entire fleet of devices - or across whatever Slicer criteria is selected - ie. the sum of the Uptime amounts over the sum of the potential Available times.

I'm having trouble working out how I'd do all this in PowerPivot.

Very appreciative of any pointers.


----------



## scottsen (Jul 1, 2014)

Hi L33 and welcome 

I think it might be helpful if we could see your power pivot model, so we can see what your relationships look like.

I get the feeling you are "over thinking" this one    If you had that second table, and created a pivot table with 
serial and date on rows, the sum of resolution would show up just like you want, by just dropping it on values.


----------



## L33 (Jul 4, 2014)

I don't doubt I'm over-thinking it, and I'm probably not explaining myself very well. No worries - I'll keep reading my new book on the subject and I'm sure the solution will reveal itself to me.

Thanks anyway.


----------



## scottsen (Jul 4, 2014)

You are making me glad that I am not an actual "excel pro", just Power Pivot    I'm never bothered that "this is easy with SUMIF's" and the like  

Your initial images are from sheets, if you gave us images of your power pivot model, that would help me and Tianbas get you going.  His answer looks like what I would have expected and it's not clear to me what is not working there.   Seeing the relationships between your tables would help us understand how the filters flow between them.

I do see some time elements (which suggests you will want a real and separate calendar table), and repeated serial #'s, which _may _suggest you will need a table where those values are unique (as dealing with a true many to many situation is a pain).  But without seeing more, it is hard to help.


----------

