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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jppv20
Solution Sage
Solution Sage

Count records in previous time interval - Direct query mode

Hi,

 

My table visual looks like this (Where "Count id" is a count of the records in that time interval and "Count id -5" should be a measure):

 

jppv20_0-1682517483732.png

 

What I need is the count of ids for the previous interval. Expected output for "Count id -5":

IntervalCount idCount id -5
4/23/2023 12:05:00 AM343251
4/23/2023 12:10:00 AM291343
4/23/2023 12:15:00 AM241291
4/23/2023 12:20:00 AM241241
4/23/2023 12:25:00 AM254241
4/23/2023 12:30:00 AM239254

 

Hope someone can help me out, thanks in advance!

 

Best,

1 ACCEPTED SOLUTION
Alf94
Solution Supplier
Solution Supplier

Hi @jppv20,

 

Can you try the following?

 

Count ID - 5 = 
    CALCULATE(
        [Count Id],
        OFFSET(
            -1,
            ,
            ORDERBY( Table[Interval], ASC )
        )
    )

 

If I answered your question, please mark my post as a solution.

 

Best,

View solution in original post

1 REPLY 1
Alf94
Solution Supplier
Solution Supplier

Hi @jppv20,

 

Can you try the following?

 

Count ID - 5 = 
    CALCULATE(
        [Count Id],
        OFFSET(
            -1,
            ,
            ORDERBY( Table[Interval], ASC )
        )
    )

 

If I answered your question, please mark my post as a solution.

 

Best,

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.