cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
Super User
Super User

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
Super User
Super User

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors