Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to have a tachometer visuals for the last 7 days for our sales quantity?

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

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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

 

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

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:

sales result.png

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.

amitchandak
Super User
Super User

@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

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.