Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
On one page I need 3 tachometers.
1. for the last 7 days
2. for the last 14 days
3. for the last 30 days
Then when I change the date it will automatically calculate the last 7 / 14 / 30 days.
I have a table for Date and Sales Quantity.
And maybe you can share a screenshot so I know how to do it.
Sorry about this, it's my first time to use PBI.
What would be the steps and formulas to resolve this?
Thanks in advance.
Christine
Solved! Go to Solution.
@Anonymous
Try measures like this
Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-7,DAY))
Rolling 14 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-14,DAY))
Rolling 30 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-30,DAY))
Prefer a date calendar.
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
I am hosting a webinar on 25th April on Power BI, Check Details - https://www.linkedin.com/posts/amitchandak78_webinar-tech-techforgood-activity-6658266754378231808-ye5L
Hi @Anonymous ,
If I got it correctly, you can create a measure like this:
Last 7 days =
VAR _date =
SELECTEDVALUE ( 'Date'[Date] )
VAR _lastsevendays = _date - 7
RETURN
CALCULATE (
SUM ( 'Sales'[Sales Amount] ),
FILTER (
ALLSELECTED ( Sales ),
Sales[Sales Date] >= _lastsevendays
&& Sales[Sales Date] <= _date
)
)
The last 14 and 30 days measure is simliar with this measure and you will get the following result:
Here is my sample file hopes to help you, please try it: PBIX
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
Try measures like this
Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-7,DAY))
Rolling 14 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-14,DAY))
Rolling 30 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-30,DAY))
Prefer a date calendar.
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
I am hosting a webinar on 25th April on Power BI, Check Details - https://www.linkedin.com/posts/amitchandak78_webinar-tech-techforgood-activity-6658266754378231808-ye5L