This formula is not working - Sum if X and Y

Hi,

For some reason I cannot get this formula to work. Basically, what I am trying to say is Sum only the values of object 1 if object 2 is one of those codes and object 3 is between those values. The results I get now are bigger, and I can tell that Webi is summing other items, but I ONLY want values summed if they meet BOTH criteria…

=Sum ([Object 1] Where ([Object 2] InList ("100";"101";"102";"103";"104";"105";"106";"107") And ([Object 3] Between (30;59))))

Another way of saying it would be: if Object 2 is (one of those codes) AND Object 3 is between 30 and 59, then sum up the total of object 1.

So object 1, although there will be a lot of them, will ONLY get added if it has both criteria set above. This is very difficult for me to get… It’s the same as Excel’s SUMIFS function.

When you say that you cannot get it to work, what are you trying?

Are all the objects from the same query?

My usual step would be to bring all the objects into a single table and add another column where I’d build the formula. Then I can check on a row by row basis that it performs as expected.

Yes, all the objects are from the same query.

Right now I have done the calculations in Excel so I know the correct value, but I cannot get Webi to do it.

I found this other post online (only other one I could find), where the guy was trying to do a very similar thing, the problem is I don’t know why I would have to create additional variables. All the items are from the same query, as you asked.

SUMIFS type of formula for Webi | SAP Community

@MarkP I did what you said, took my table and added a column then added the formula. When I see what happens, it shows a value on the first item that meets that criteria, then when I find a second one, it does not provide a value…

This is very disappointing that Webi does not have a simple SumIf function like excel…

Despite tables, it’s not Excel. You can’t think of absolutes like =SUM(B2…B65) and so on.

You shouldn’t have to create additional formula, we’ll work through this together. :slightly_smiling_face:

What data types are objects 1, 2 and 3? Both in terms of dimension/measure/detail and string/number?

1 Like

I’m so embarrassed to say this, but I think I figured it out. That formula I provided actually did the trick (acting like a SUMIF). Basically, I had missed some other “codes” that I had to included to get the value that I expected.

2 Likes

Funny how sometimes forcing yourself to start from the beginning shows the error. Well done!

1 Like