cancel
Showing results for
Did you mean: Regular Visitor

## Sum Only for Selected Month Number YTD

Dear friends,

i have question, how can i sum actual data only month 1 to 8 within 2020 & 2021 using DAX. Here is the table : Here is the data :

 year month forecast actual 2020 1 7 7 2020 2 10 5 2020 3 10 10 2020 4 8 8 2020 5 6 7 2020 6 5 7 2020 7 7 7 2020 8 6 9 2020 9 10 8 2020 10 5 9 2020 11 7 10 2020 12 9 10 2021 1 7 9 2021 2 6 10 2021 3 9 10 2021 4 10 6 2021 5 10 6 2021 6 9 6 2021 7 8 7 2021 8 5 9 2021 9 9 2021 10 5 2021 11 5 2021 12 10

Thanks for help..

1 ACCEPTED SOLUTION  Resolver I

@ade_kurniawan Oh sorry, I didn't understand. Here are the correct measures:

Sum_Actual =
VAR MAXXX = CALCULATE(MIN(Tabella[month]) -1, FILTER (ALL(Tabella),
Tabella[actual] = BLANK () || Tabella[forecast] = BLANK()))
RETURN CALCULATE(SUM(Tabella[actual]), Tabella[month] >= 1 && Tabella[month] <= MAXXX, ALLEXCEPT(Tabella,Tabella[year]))

Sum_Forecast =
VAR MAXXX = CALCULATE(MIN(Tabella[month]) -1, FILTER (ALL(Tabella),
Tabella[actual] = BLANK () || Tabella[forecast] = BLANK()))
RETURN CALCULATE(SUM(Tabella[forecast]), Tabella[month] >= 1 && Tabella[month] <= MAXXX, ALLEXCEPT(Tabella,Tabella[year]))

I hope it is the desired!
B.

7 REPLIES 7 Regular Visitor

@bf thanks for response, here is result i want :   Resolver I

Here are the two measures, to be included in the new table with the column year:

• Sum_Actual = CALCULATE(SUM(Tabella[actual]), Tabella[month] >= 1 && Tabella[month] <= 8, ALLEXCEPT(Tabella,Tabella[year]))
• Sum_Forecast = CALCULATE(SUM(Tabella[forecast]), Tabella[month] >= 1 && Tabella[month] <= 8, ALLEXCEPT(Tabella,Tabella[year]))

Try and tell me if it works!

B. Regular Visitor

How about find number 8 automatically ? when data updated at month 9, i hope will automatically update sum month 1 to 9.. thanks  Resolver I

@ade_kurniawan Oh sorry, I didn't understand. Here are the correct measures:

Sum_Actual =
VAR MAXXX = CALCULATE(MIN(Tabella[month]) -1, FILTER (ALL(Tabella),
Tabella[actual] = BLANK () || Tabella[forecast] = BLANK()))
RETURN CALCULATE(SUM(Tabella[actual]), Tabella[month] >= 1 && Tabella[month] <= MAXXX, ALLEXCEPT(Tabella,Tabella[year]))

Sum_Forecast =
VAR MAXXX = CALCULATE(MIN(Tabella[month]) -1, FILTER (ALL(Tabella),
Tabella[actual] = BLANK () || Tabella[forecast] = BLANK()))
RETURN CALCULATE(SUM(Tabella[forecast]), Tabella[month] >= 1 && Tabella[month] <= MAXXX, ALLEXCEPT(Tabella,Tabella[year]))

I hope it is the desired!
B. Regular Visitor  Resolver I

@ade_kurniawan  for me it's working. Let's see: What's wrong with you?

B.  Resolver I

can you give me the expected result? in order to be sure you understand the request.

Thx,

B.  