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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
rfwjr64
Frequent Visitor

Measure to calculate number of records within a period of time.

Hello, I am relatively new to writing PBI measures.  I am trying to calculate the following:

I want to provide a status of the last 30 days, 60 days, etc. from the approval date (which is a column) based on the status of another column (the column being Quote Status).  If the quote status is "No Quote Received", How many records that were received in the last 30 days has that status.  (then I want to provide the same status for the last 60 days).  

 

If somebody can guide me I would appreciate it.  I would also need to know how to apply a solution (e.g. click on New Measure, etc).

 

Thanks very much in advance. 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rfwjr64,

You can also use the date function to manually defined the rolling calculation ranges. It should more agility than time intelligence functions.

rolling one month=
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date] >= DATE ( YEAR ( currDate ), MONTH ( currDate )-1, DAY ( currDate ) )
                && [Date] <= currDate
        )
    )

In addition, if you want to reference other column value as the condition in the formula, please make sure they has relationships then you can simply add them to current expressions.

rolling one month=
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date]
                >= DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
                && [Date] <= currDate
        ),
        FILTER ( ALLSELECTED ( Table2 ), [Column] = "xxxxx" )
    )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@rfwjr64 , see a measure like this can help

Example

Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-30,Day))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for replying  .  Can you also include the condition that another column ('Quote status') needs to be set to 'No Quote Received' in order to be calculated.  If the status is something else, no calculation is required. 

Anonymous
Not applicable

Hi @rfwjr64,

You can also use the date function to manually defined the rolling calculation ranges. It should more agility than time intelligence functions.

rolling one month=
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date] >= DATE ( YEAR ( currDate ), MONTH ( currDate )-1, DAY ( currDate ) )
                && [Date] <= currDate
        )
    )

In addition, if you want to reference other column value as the condition in the formula, please make sure they has relationships then you can simply add them to current expressions.

rolling one month=
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date]
                >= DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
                && [Date] <= currDate
        ),
        FILTER ( ALLSELECTED ( Table2 ), [Column] = "xxxxx" )
    )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors