Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ce2016
Frequent Visitor

Sales Sum of next month

Dear all,

I am looking for a way to sum demand of the next month (rolling).

Regarding the data set I do only have monthly data that is displayed with the first day of the month (01.MM.YYYY)

I did try an approach with the NEXTMONTH function:

 

Sum Demand next month = CALCULATE (SUM('Input'[Total Demand Quantity]); NEXTMONTH('Stock Cover_Input'[Date]))

 

However this did not work.

 

So overall it should like this, but in the column "Sum demand next month" the sum of demand of the next month should be shown.

 

Sum next month.PNG

 

 

Do you have any idea how to make this work?

 

Thank you very much in advance!

 

 

1 ACCEPTED SOLUTION

Hi,

Try this

 

1. Setup a relationship between Dummy[Date] and Date[Date]. Currently the relationship was setup incorrectly

2. Edit your [Sum Demand Next Month] measure and use the following code = CALCULATE(SUM(Dummy[Total Demand]),DATEADD('Date'[Date],1,MONTH)) 

3. Use Dates in the table rather than cal year/ month

 

Now the table should work. A snapshot

Capture.PNG

 

 

Take a look at the pbix attached

 

View solution in original post

8 REPLIES 8
Zubair_Muhammad
Community Champion
Community Champion

@ce2016

 

Give this a shot please

 

Sum Demand next month =
VAR mydate =
    EOMONTH ( SELECTEDVALUE ( 'Stock Cover_Input'[Date] ), 0 ) + 1
RETURN
    CALCULATE (
        SUM ( 'Input'[Total Demand Quantity] ),
        'Stock Cover_Input'[Date] = mydate
    )

Regards
Zubair

Please try my custom visuals

Hey @Zubair_Muhammad, it did not work either unfortunately...only a blank column as a result 😕

Hi @ce2016,

 

Please create a calendar table (with continuous dates that cover your whole period) and then link it to your data model.

Then use your formula, it should work.

 

I made a test and it worked on my side.

 

Ninter. 

Hi @Interkoubess,

 

I created a Date table, following the instructions of this webpage:

https://kohera.be/blog/business-intelligence/how-to-create-a-date-table-in-power-bi-in-2-simple-step...

 

Then I linked the Date table with my main data table via date as key (1:*-relationship).

 

However, this also does not seem to work..

 

Data rows are always dated on the first of a month, does it have to do something with that eventually?

 

Thanks!

Hi @ce2016,

 

Please share dummy data and I will help.

 

Thank you.

 

Ninter

Hi Ninter @Interkoubess,

 

Thank you so much for your help.

 

I uploaded a dummy file on a dropbox folder:

 

https://www.dropbox.com/s/zcxlult57kwgfle/Dummy%20Sum%20Demand%20Nxt%20Month.pbix?dl=0

 

Thanks again for your support!

Hi,

Try this

 

1. Setup a relationship between Dummy[Date] and Date[Date]. Currently the relationship was setup incorrectly

2. Edit your [Sum Demand Next Month] measure and use the following code = CALCULATE(SUM(Dummy[Total Demand]),DATEADD('Date'[Date],1,MONTH)) 

3. Use Dates in the table rather than cal year/ month

 

Now the table should work. A snapshot

Capture.PNG

 

 

Take a look at the pbix attached

 

Works! Thank you guys!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.