Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Guys. Got a question in regards to displaying data based on dates.
So on a line graph, I would like to show data based on number of days leading up to the date selected.
For example, if selected date is 01/07/2022 - 15/07/2022, I would like to show the data 15/06/2022 - 30/06/2022.
Similiarly if dates are selected 01/03/2022 - 25/04/2022, a total of 56 days, I would like to show previous 56 days worth of data i.e. 03/01/2022 - 28/02/2022 (56 Days).
Any help would be appreciated
Solved! Go to Solution.
Hi, @azakir
Please modified the formula as below:
You need to add 1 day to the variable 'datediff1'.
Best Regards,
Community Support Team _ Eason
hi @amitchandak
I worked out the formula:
But it's not giving me the correct number.
For example, between 01/01/2022 - 31/01/2022, a total of 31 days, we had 273 Tyres.
By using this formula, if I now choose 01/02/2022 - 03/03/2022 (31 days), the formula "Last Period" should give 273 tyres, but it's showing 278:
Hi, @azakir
Please modified the formula as below:
You need to add 1 day to the variable 'datediff1'.
Best Regards,
Community Support Team _ Eason
@azakir , Try a measure like
same period based on date range
Last Period =
var _max =maxx(allseleceted(date),date[date])
var _min =maxx(allseleceted(date),date[date])
var datediff1 = datediff(_min,_max,day)
var _maxX = _max-datediff1
var _minX = _min -datediff1
return
CALCULATE(SUM(Sales[Sales Amount]),filter(all(date,date[date]<=_maxX &&date[date]>=_minX)))
Hi @amitchandak
Thanks for your help. Can I please request if you could kindly check the calculate formula, there are some errors with the formula which I am getting using that.
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |