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.
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.
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 |
---|---|
103 | |
101 | |
84 | |
77 | |
66 |
User | Count |
---|---|
134 | |
108 | |
104 | |
83 | |
73 |