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.
I need to build a measure that will give me the the Cummulative Gross Sales for the same period last year.
I have my Gross Sales for 2020 by using Year and Gross Sales Measure. These Gross Sales incorporate sales for the last 303 Days (Jan 1, 2020 - Oct 29, 2020)
However, I dont know how to arrive at a measure that will give me Gross Sales for the first 303 Days of 2019 and that is dynamic so tomorrow the measure will update to the first 304 Days of 2019.
I have tried:
but it is not providing the correct result.
Any help would be appreciated!
Hi @707Ute
Do you want the measure to always display the Cummulative Gross Sales until today for the previous year without needing user to select a date? If so, you could also take the following measures for some reference. I use TODAY() function to get today value automatically.
TY Gross Sales = CALCULATE(SUM('Table'[Sales]),DATESBETWEEN('Calendar'[Date],DATE(YEAR(TODAY()),1,1),TODAY()))
LY Gross Sales =
VAR lastYear = YEAR(TODAY())-1
VAR month = MONTH(TODAY())
VAR day = DAY(TODAY())
RETURN
CALCULATE(SUM('Table'[Sales]),DATESBETWEEN('Calendar'[Date],DATE(lastYear,1,1),DATE(lastYear,month,day)))
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
@707Ute , Try measure like
Last Year YTD Gross Prod Sales = CALCULATE(SUM('1-Measures and Calculations'[Gross Sales USD]),DATESYTD('Date - Transaction Date'[PK_Date],-1,year))
LYTD forced=
var _max1 =maxx('1-Measures and Calculations',[Sales date]) //or maxx(allselected('Date - Transaction Date'),'Date - Transaction Date'[PK_Date])
var _max = date(year(_max1)-1,month(_max1),day(_max1))
return
CALCULATE(SUM('1-Measures and Calculations'[Gross Sales USD]),DATESYTD(dateadd('Date - Transaction Date'[PK_Date],-1,year)),'Date - Transaction Date'[PK_Date]<=_max)
Hi @707Ute ,
In Power Query add new column:
YTD Criteria = if Date.DayOfYear([Date]) <= Date.DayOfYear(DateTime.LocalNow()) then 1 else 0
After that create a measure:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |