Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi there,
The below DAX Function is the function for same period last year, but I only want to see the values up to the March 30th of last year. I want to see the exact same time frame YOY and I would like my data to populate automatically as the days progress throughout the year. Please see measure below. PBI is saying that I have too few arguments for DatesBetween.
Sample period last year and Trailing measure with Date dimension will work, for that, you need to make some date is selected on the page
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
or try like
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"),'Date'[Date]<=today())
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"),'Date'[Date]<=date(year(today()-1),month(today()),day(today()))
I'm sorry, no this did not work.
However, I attempted another measure like this but now I am experiencing missing data since there were no sales on certain dates this year in 2020. All I want is my data to stop on the current day (today) (max day). For example if today was March 25th 2020 then all I would want to pull is Prior Year Jan 1 2019 to March 25 2019. The exact same time period. I would not want to pull entire month or year. Just pull net sales up current date. Below is the formula I used and the missing data
Hi @LyncoData1 ,
Please try this one.
SamePeriodLatYear =
VAR tod =
TODAY ()
VAR lastyear =
DATE ( YEAR ( tod ) - 1, MONTH ( tod ), DAY ( tod ) )
VAR firstday =
DATE ( YEAR ( tod ) - 1, 1, 1 )
RETURN
CALCULATE (
[Net Sales],
FILTER (
ALL ( 'DimCalendar' ),
'DimCalendar'[DateKey] <= lasytear
&& 'DimCalendar'[DateKey] >= firstday
)
)
If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive for Business and share the link here.
This did not work. However, I did use the two measures below that gave me what I wanted for Net Sales. However, now I need help with finding YTD MTD Sales based on the measures listed below to ensure they fall into the current "TODAY" time frame. Would you have any insight ?
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
86 | |
82 | |
70 | |
49 |
User | Count |
---|---|
143 | |
123 | |
107 | |
61 | |
55 |