• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sales Current Year and Sales Previous Year

powerbilead

New Member
Hi Team,
I am trying to calculate Current Year Sales and Previous Sales. I have a Date table and sales table with a one to many relationship.

SalesCY = CALCULATE(tblsales[TotalSales], YEAR(dates[Date]) = YEAR(TODAY()))
SalesPY = CALCULATE(tblsales[TotalSales], SAMEPERIODLASTYEAR(dates[Date]))

I have attached sales data file
 

Attachments

  • sales.xlsx
    9.9 KB · Views: 4
I am sorry I forgot to mention that with the second formula I am not getting 2550 for Previous Year Sales. I am getting 7550.

SalesPY = CALCULATE(tblsales[TotalSales], SAMEPERIODLASTYEAR(dates[Date]))


Thanks for the help
 
I'd recommend uploading file with your data model (date & sales tables).

Without knowing structure of your dates table, hard to say what's causing issue with your DAX. I suspect, that you don't have full calendar year (dates) in your dates table. But can't confirm with your sample.
 
Back
Top