cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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

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.

View solution in original post

4 REPLIES 4
Framet
Resolver II
Resolver II

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

what about:

 

=
CALCULATE (
    SUM ( [revenue] ),
    DATESBETWEEN (
        calendar[date],
        DATEADD ( TODAY(), -13MONTH ),
        TODAY ()
    )
)

Anonymous
Not applicable

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 ()
)
)

 

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.

View solution in original post

Anonymous
Not applicable

Brill! Works a treat!

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors