cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vsgarciap Regular Visitor
Regular Visitor

Sum of the amount of sales the previous 5 months

Hi;

 

I want to calculate the cumulative of sales quantity of the previous 5 months without counting the current also I want it to be dynamic depending on the current month.

 

Data example bellow

EXAMPLE DAX.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Sum of the amount of sales the previous 5 months

Hi,

Drag this measure to a card visual

=CALCULATE([Cantidad],DATESBETWEEN(Calendar[Date],EDATE(EOMONTH(TODAY(),-1)+1,-5),EOMONTH(TODAY(),-1)+1))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Super User III
Super User III

Re: Sum of the amount of sales the previous 5 months

Hi @vsgarciap ,

 

Try the following measure:

 

Sum Last 5 Months =
CALCULATE (
    SUM ( 'Table'[Quantity] );
    DATESINPERIOD ( 'Table'[Date]; MAX ( 'Table'[Date] ); -6; MONTH )
)
    - SUM ( 'Table'[Quantity] )

Replace the table name by the your data. If the date column is on a different table just change also that column to the correct one.

 

Regards,

MFelix


Regards

Miguel Felix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




vsgarciap Regular Visitor
Regular Visitor

Re: Sum of the amount of sales the previous 5 months

It doesn't work because I have a data since 2016. Data Exp.JPG

 

Super User III
Super User III

Re: Sum of the amount of sales the previous 5 months

The number of dates should no be an issue, since the calculations is made based on your date a going backward.

Did you tried the measure?

Can you share a mockup file?
Regards,
MFelix

Regards

Miguel Felix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Super User IV
Super User IV

Re: Sum of the amount of sales the previous 5 months

Hi,

Drag this measure to a card visual

=CALCULATE([Cantidad],DATESBETWEEN(Calendar[Date],EDATE(EOMONTH(TODAY(),-1)+1,-5),EOMONTH(TODAY(),-1)+1))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

vsgarciap Regular Visitor
Regular Visitor

Re: Sum of the amount of sales the previous 5 months

It Works, thank you.

Super User IV
Super User IV

Re: Sum of the amount of sales the previous 5 months

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors