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
Anonymous
Not applicable

DAX. SUM of Value based on previous rows filtered by indicators

Hi,

I am unable to think of a DAX, that would add value from different row in same table based on date and identicator (Previous month needed)

ArtursM_0-1659445984877.png

I need to add value from previous month to the row for next month. 

I tried: 

= Calculate( SUM(Value), Filter( ALLEXCEPT(Table,Name), Date= Date previous month))
Date previous month is calculated with:
= PREVIOUSMONTH(Date)
The DAX needs to take only value from previous month. In data I have a large data size, so there are hundreds of names and several years of data.
 
This give me only blanks with no errors. 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Found a solution:

VAR Previous_Month = DATEADD(Date,-1,MONTH)

return CalculateSUM(Value), FilterALLEXCEPT(Table,Name), DatePrevious_Month))

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Found a solution:

VAR Previous_Month = DATEADD(Date,-1,MONTH)

return CalculateSUM(Value), FilterALLEXCEPT(Table,Name), DatePrevious_Month))

amitchandak
Super User
Super User

@Anonymous , if have date, then create a date table you can try like

 

Calculate( SUM(Value),PREVIOUSMONTH(Date[Date]) )

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.