Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I'm using a DatesInPeriod with an =Calculate formula. The DatesInPeriod goes 6 months back, This works perfectly, except for Feb 2016 which is a leap year. It calculates 7 months. Has anybody else had this problem with the leap year?
Hi,
Try this measure
=CALCULATE(SUM(Data[Value]),EDATE(MIN(Calendar[Date]),-6))
There should be a relationship from the Date column of the Data Table to the Date column of the Calendar Table. Ensure that in the filter or slicer, you select any one month.
Hope this helps.
Hi Ashish, I tied using the edate but it returns one value for the last 6 months. I'm looking for a rolling 6 months total to be calculated. Thanks for the suggestion
How do you write the formula? it is a calculated column or a measure?
Could you share me the formula nad the screenshot when apply the formula?
I test with the following formula, it calculate the value from 2015/9/1~2016/2/29, Does this meet your need?
Column = CALCULATE(SUM(Sheet2[value]),DATESINPERIOD(Sheet2[date],DATE(2016,2,29),-6,MONTH))
Best Regards
Maggie
Hi Maggie,
Thanks for the suggestion. I'm using a rolling calculation for the last 6 months sales. I'm passing the end date as a variable from another table.
T6 Months Sales =
var lastsaledate = lastdate('Data'[Date])
Return
CALCULATE([Sales Total],all('Date Master Table'),DATESINPERIOD('Date Master Table'[Master Date],lastsaledate,-6,MONTH))
So I'm not able to hard code the starting date as per your suggestion
I make a test on my site as below
for 2016/2, it calculates the last 6 months sales between 2015/9~2016/2
for 2016/7, it calculates the last 6 months sales between 2016/2~2016/7
Is my test correct?
Could you provide some screenshot on your side for better analysis?
Additionally, here are some other methods about rolling 6 months sum
https://www.kasperonbi.com/show-only-the-sales-for-the-last-12-months/
https://stackoverflow.com/questions/50357343/power-bi-rolling-6-month-sum
Best Regards
Maggie
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |