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
IamTDR
Responsive Resident
Responsive Resident

Measure for Sales for Previous Year by Day

Hello

I am wondering if any knows how to calculate a sales measure to sum sales from the previous year by day?  I have a 'Sales_tbl' and a 'Date' table.  My Sales table has fields Date and Sales Amount.  Sales table has activity for rolling three years.  My date table is based on the dates available in my Sales table.

 

So for example, when I do 'calculate(sum(sales_tbl[amount],filter('Date',Max('Date'[Fiscal Year]) = 'Date'[Fiscal Year]))' this will give me sales for my current fiscal year depending on the month slicer I select. So for example, if I select Month 'May' from my slicer, today I will see sales for May 1 - May 3 2023. 

How do I create a measure for sales from May 1 - May 3 2022?  If I use a similar measure like the one provided above, it will return the full month of May 2022's sales.  I am looking to compare May sales day by day.

 

Any ideas?

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Ensure that:

  1. The last date in the Date table is up until today; and
  2. The slicer of Month has been created from the Calendar Table

Write these measures

Total sales = sum(Data[sales])

Total sales in SPLY = calculate([Total sales],sameperiodlastyear(Date[Date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Ensure that:

  1. The last date in the Date table is up until today; and
  2. The slicer of Month has been created from the Calendar Table

Write these measures

Total sales = sum(Data[sales])

Total sales in SPLY = calculate([Total sales],sameperiodlastyear(Date[Date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@IamTDR , try measures like

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))


Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

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.