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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Time intelligence case!

Hi Guys,

 

I have a large data set of monthly data over several years and have calculated last months sales using the following DAX.

 

Total sales last month = CALCULATE ([Total sales];
                                                   DATEADD (Dates[Date];-1;MONTH ) )

 

 I have no sales data for any months of January and hence no "sales last month" in february.. For my purpouse I need to move all "Total sales last month" in January to February.. Does anybody have a solution to that?

 

DateTotal SalesTotal Sales Last Month
December 201520050
January 20160200
February 20161000

 

(I need to get the 200 in January 2016 down to February 2016)

 

Would be greatly appreciated!

1 ACCEPTED SOLUTION
Chris99
Advocate III
Advocate III

Hi @Anonymous,

 

Can you do

 

Total sales last month = IF

(

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-1;MONTH ) ) = 0;

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-2;MONTH ) );

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-1;MONTH ) );

 )

 

or were you hoping for something that would work backwards and find the fisrt non zero value?

 

Chris

View solution in original post

3 REPLIES 3
Chris99
Advocate III
Advocate III

Hi @Anonymous,

 

Can you do

 

Total sales last month = IF

(

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-1;MONTH ) ) = 0;

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-2;MONTH ) );

   CALCULATE ([Total sales]; DATEADD (Dates[Date];-1;MONTH ) );

 )

 

or were you hoping for something that would work backwards and find the fisrt non zero value?

 

Chris

Anonymous
Not applicable

Hi @Chris99

 

That WOOOOOORKED! Thanks :))

 

Been struggling for ages!

 

 

 

@Anonymous- Glad to have helped Smiley Happy

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.