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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Tanaka
Frequent Visitor

Aggregate last month value to next monrth

Hello,

i've the follow table

 

 

JanuaryFebruaryMarch
Sales56282
Cancelled3619
SubTotal20263
Total   

 

I'm trying to sum subtotal of the last month with the next one, already tried this measure, but it returns blank rows.

Previous =
CALCULATE(
Table1[Subtotal]
,PREVIOUSMONTH(Table1[Date])
)
 

The desired output would be as follows.

 JanuaryFebruaryMarch
Sales56282
Cancelled3619
SubTotal20263
Total22 (this month Subtotal + last month Total)

265 (this month Subtotal + last month Total)


Any ideas?

Regards.



1 ACCEPTED SOLUTION

See if this works. I've create a Date Table in the model

model.JPG

With this measure:

Previous SubTotal  + Total =
CALCULATE (
    [Subtotal],
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

Result.JPG

 I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

Can you please post sample data (you can recreate the table structure + data in Excel) replicating the structure of your data?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






See if this works. I've create a Date Table in the model

model.JPG

With this measure:

Previous SubTotal  + Total =
CALCULATE (
    [Subtotal],
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

Result.JPG

 I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Nice !! =D

Thank you ! !

PaulDBrown
Community Champion
Community Champion

What is the actual structure of the data? Does the data include dates? Do you have a Date Table?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I don't have a date table.

I do have a date column.
I distinct count  IDs to get Sales, and for the cancelled ones i distinct count filtering where status is cancelled.
Subtotal is just the substraction of both results.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Users online (2,932)