cancel
Showing results for
Did you mean:
Highlighted
Member

## Work out total number of sales for past 13 month period

Hi,

I am wanting to sum the sales

(revenue) for the 13 past 13 month in a measure.

What would the code be to do this

Im thinking something like

`=Calculate(sum(revenue),datesbetween(dateadd(calender(date),-13,Month),dateadd(today))`

But it doesnt work.

C

1 ACCEPTED SOLUTION

Accepted Solutions
Regular Visitor

## Re: Work out total number of sales for past 13 month period

DateADD shouldn't look at a column but instead I assume you want it to be Today(). This will create a measure that always looks at 13 months from today. If you want 13 months from the selected date then it will need to be something like FirstDate(Calendar1[date]) as the first dateadd paparmeter.
4 REPLIES 4
Regular Visitor

## Re: Work out total number of sales for past 13 month period

I'm not sure you can have dateadd(today)

=
CALCULATE (
SUM ( [revenue] ),
DATESBETWEEN (
calendar[date],
TODAY ()
)
)

Member

## Re: Work out total number of sales for past 13 month period

Thanks for getting back, unfortunatly I am still receiving an error.

A table of Multiple values was supplied where a single value was expected

I amended the revenue to column3 as that is what it is called in the database.

```=CALCULATE (
SUM ( [Column3] ),
DATESBETWEEN (
Calendar1[Date],
DATEADD ( Calendar1[Date], -13, MONTH ),
TODAY ()
)
)```

Regular Visitor

## Re: Work out total number of sales for past 13 month period

DateADD shouldn't look at a column but instead I assume you want it to be Today(). This will create a measure that always looks at 13 months from today. If you want 13 months from the selected date then it will need to be something like FirstDate(Calendar1[date]) as the first dateadd paparmeter.
Member

## Re: Work out total number of sales for past 13 month period

Brill! Works a treat!

Announcements

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 123 members 1,756 guests
Recent signins: