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 have the sales for last year same period ( like 01/01/2015 to 06/10/2015) copmpared to this years to date sale
I'm using this DAX:
LY YTD Sales = CALCULATE([LY Sales],SAMEPERIODLASTYEAR(DateDimension[Date]))
LY Sales = CALCULATE([Total Sale], SAMEPERIODLASTYEAR(DateDimension[Date]))
Total Sale = SUMX(OrderArchive,OrderArchive[Total])
But what it returns it the toal sales for all years before ( my data contains from 2010) and not only 2015!
I tried DATEADD(xxx,-1,year) but still hetting same reults. what am I doing wrong ?
This is the data where comparing sales for each month per year
here is the reults of DAX as I mentioned above
Thanks in advance for looking this up
Solved! Go to Solution.
@iLikeAzureSQL these functions need context to work properly like in a table/matrix with a YEAR field
This is obviously not present in a Card!
So for a Card use something like this instead...
LY Sales = CALCULATE ( [Total Sale], FILTER ( 'Calendar', 'Calendar'[Year] = MAX ( 'Calendar'[Year] ) - 1 ) )
Hi
I suggest u y not go withparallelperiod
Measure = calculate(sum(sales),parallelperiod(Date,-1,Year)
try this....
@iLikeAzureSQL these functions need context to work properly like in a table/matrix with a YEAR field
This is obviously not present in a Card!
So for a Card use something like this instead...
LY Sales = CALCULATE ( [Total Sale], FILTER ( 'Calendar', 'Calendar'[Year] = MAX ( 'Calendar'[Year] ) - 1 ) )
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 |
---|---|
107 | |
94 | |
77 | |
63 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |