Forum Discussion

Raaz's avatar
Raaz
Icon for Helper II rankHelper II
6 years ago

Running count hourly from table with no timestamp

Hi Community Experts,

 

I need to calculate count of a column on hourly basis from a tbale that has date but no time information/time stamp.

I read many artices, questions online. ALl mention the soloution from a table that already has tiem stamp.

 

My table is like this

 

ship_date         order#

04-1-2020        123

04-1-2020        124

04-1-2020        125

.........                  .....

04-1-202         134

 

What I want is, when user runs the report on 04-1-2020 at 10AM , count of order is diaplyed lets say 3

when run the report at 11AM, count of record is displayed say 7 like this

 

Time      Count of order

 

10AM      1

11AM      5

12AM     9

1PM     12

2PM     14

 

How this can be achieved. Any help will be appriciated

 

Thanks,

Raazia

 

 

 

What 

5 Replies

  • kentyler's avatar
    kentyler
    Icon for Solution Sage rankSolution Sage

    I'm not clear about what you want.

    Do you want the counts of orders to be updated whenever the user runs the report, so that it is always current and up to date ?

    • Raaz's avatar
      Raaz
      Icon for Helper II rankHelper II

      Yes, current updated count with previuos count as well.

       

      let say user runs the report at 9AM, output should be

       

       

      9AM      3

      at 10 AM when report is run, out pout should be

      9AM    3

      10AM   7

       

      at 11AM, output should be

       

      9AM   3

      10AM   7

      11AM   8

       

      Thanks in advance

       

      • kentyler's avatar
        kentyler
        Icon for Solution Sage rankSolution Sage

        Your problem is that power bi cannot easily write data, so recording the times your reports are run is tricky.

        You could always run the reports at fixed hours of the day.... in which case your reports would be counting the records betwen different sets of predetermined hours.
        Or you could take an approach like the one explained here https://www.youtube.com/watch?v=UFD5S4Peqc4  where a dax measure actually can write back to a sql database and record the time when a report is run...... for this to work you would have to refresh your data in power bi every time you wanted to re-run the report, so the report measures would have access to the record that tells the last time the report was run.