cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jak82 Member
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
Framet Regular Visitor
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
Framet Regular Visitor
Regular Visitor

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

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

what about:

 

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

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

 

Framet Regular Visitor
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.
jak82 Member
Member

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

Brill! Works a treat!

Helpful resources

Announcements
Virtual Launch Event

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

Power BI Helps Homeless and Trouble Youth

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

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 123 members 1,756 guests
Please welcome our newest community members: