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
Gonza
Regular Visitor

Compare previous and new sales for product

Hi,

Building a report and slicing by year and month.

I want to compare the sales with earlier sales consider the product , so I try with

 

  • RevenueLastYTDBU = CALCULATE(sum(Sales[REAL_ValorNeto]); SAMEPERIODLASTYEAR(Sales[FechaPivot]);All(Sales))

and 

  • RevenueLastYTD = CALCULATE(sum(Sales[REAL_ValorNeto]); SAMEPERIODLASTYEAR(Sales[FechaPivot]);AllExcept(Sales;Sales[FechaPivot]))

 

However, I don´t get returned sales for year, month and product.

 

Are there manner ways to compare sales in previous periods for each product? E.g. the amount for product: "machines" in 29/1/2017 must be zero.

 

records.png

1 ACCEPTED SOLUTION
dearwatson
Responsive Resident
Responsive Resident

I think you just need to remove the ALL(Sales) at the end to get the desired result.

 

with ALL you are removing the Product filter which you want to keep in place.

 

I got the below result with this measure:

Total Sales = SUM(Data[Value])

Sales Last Year = CALCULATE([Total Sales],SAMEPERIODLASTYEAR(Data[Date]))

 

Capture.PNG

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

View solution in original post

4 REPLIES 4
dearwatson
Responsive Resident
Responsive Resident

I think you just need to remove the ALL(Sales) at the end to get the desired result.

 

with ALL you are removing the Product filter which you want to keep in place.

 

I got the below result with this measure:

Total Sales = SUM(Data[Value])

Sales Last Year = CALCULATE([Total Sales],SAMEPERIODLASTYEAR(Data[Date]))

 

Capture.PNG

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

dearwatson, thank you so much for your help. 
But, something is missing because I can not get the result despite eliminating ALL(Sales).
The error is the same.

Please send me your .pbix file
is That possible?

 

dearwatson
Responsive Resident
Responsive Resident

Sure no problem

 

not sure how to attach but here's a onedrive link.

 

Sales.pbix

 

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

Excellent !! Thank you.

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.