cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

Hi community,

## 2. Calculate the sum of Sales up to the current month

YTD Sum =
VAR CurrentMonth = 10
RETURN
TOTALYTD([Sales Measure]
, 'Dates'[Date]
, 'Dates'[Month] <= CurrentMonth)​

## 3. Calculate the sum of Sales including the forecast for future months.

Here I need help. I thought SUMX would do the job adding up all values of my Sales + Forecast Measure. But it does not work like I expected.
Sales + Forecast Sum =
SUMX(Dates, [Sales + Forecast])

I want my Sales + Forecast Sum to just add up the red circled values. How can I archieve this?

DAX still is so confusing to me.. I would also appreciate any suggestions of improving my DAX code!

Cheers, Myriam

1 ACCEPTED SOLUTION
Frequent Visitor

Okay I think I found out myself. Dunno if thats the "beste" solution, but this is working in my case:

Sales + Forecast Sum =
SUMX(VALUES(Dates[Month]), [Sales + Forecast])
3 REPLIES 3
Frequent Visitor

Okay I think I found out myself. Dunno if thats the "beste" solution, but this is working in my case:

Sales + Forecast Sum =
SUMX(VALUES(Dates[Month]), [Sales + Forecast])
Community Champion

@MyriamW I don't mean to offend, but you're doing this all wrong.  Most of all, you're hard coding values into variables which means you're going to need to update this every month.

Could you please supply some sample data?

Frequent Visitor

I should have said that of course in my real report I am not hardcoding any values. I do have variables with MONTH(TODAY()) etc. But as the sample data (I just used some from MS) is not actual data that wouldn't work, and for time reasons I just hardcoded to display my issue.

You can find my sample pbix here: SampleCalculateForecast.pbix

(Hope it is working, I am not able attach the file directly)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.