2 Replies Latest reply: Jun 17, 2018 4:20 PM by Mustafa Botsalı

# RangeSum Function with If Condition

Hi,

So I have this rangeSum function in a table perfectly working:

rangeSum (Below(Sum([Sales]),0,(\$(vMonthCalc)+1)))

Here variable vMonthCalc keeps track of the interval between current month and the beginning of the year by checking a date field. (I.E. for 01.01.2018 it holds 0, for 01.02.2018 it holds 1, 01.11.2017 it holds 10 and so on).

And I have two products in my Products field, A and B. I only need to calculate total amount of sales for product A since the beginning of the year. But my function as you can imagine gives me the total sales for product A and B.

(I.E.

Date                  Products   Sales

01.01.2018              A           20

01.01.2018              B           30

01.02.2018              A           10

01.02.2018              B           20

)

The function holds 50 for January and 80 for February. But I need to hold 20 for January and 30 for February.

I tried to use an if condition everywhere in the formula but couldn't succeed.

Can anyone help me where to put an if condition or how to make a set analysis for this condition ?

Thanks a lot.

• ###### Re: RangeSum Function with If Condition

May be this

RangeSum(Below(Sum({<Products = {'A'}>} [Sales]), 0, (\$(vMonthCalc)+1)))

• ###### Re: RangeSum Function with If Condition

worked fine thanks a lot