Forum Discussion
Count rows at different time zone
Hello,
I would like to count rows on a production sheet, every day. I need to count rows from 6am to 6 am, and show it on a graph with usual date 12pm to 12pm.
I have on the same table a column with "real date", "date -6 hours", and several parameters not relevant here.
As an example, here below would be my data :
| start date/time | start date/time -6h | op |
| 12.07.2021 09:00 | 12.07.2021 03:00 | 1 |
| 12.07.2021 15:00 | 12.07.2021 09:00 | 2 |
| 12.07.2021 17:00 | 12.07.2021 11:00 | 2 |
| 12.07.2021 19:00 | 12.01.2021 13:00 | 4 |
| 13.07.2021 01:00 | 12.07.2021 19:00 | 5 |
| 13.07.2021 05:00 | 12.07.2021 23:00 | 6 |
| 13.07.2021 07:00 | 13.07.2021 01:00 | 7 |
| 13.07.2021 15:00 | 13.07.2021 09:00 | 8 |
And here below the result I wish I could calculate (and show it on a graph)
| start date/time | Number of op |
| 12.07.2021 | 6 |
| 13.07.2021 | 2 |
But all I can manage to have is :
| start date/time | Number of op |
| 12.07.2021 | 4 |
| 13.07.2021 | 4 |
I though that I could count rows for "start date/time -6h.[date]" and relate it to "start date/time" at some point...
I have tried to create two tables, one for "start date/time" (actual date/time) and one for "start date/time -6h" (the date/time I want to rely on to calculate). But I cannot get the correct formula/relationship to have what I'm looking for.
Any thought?
Thank you for your help!!
Noelle
3 Replies
- AnonymousNot applicable
Hi Noelle
I have done one like this, you can use two tables as well
Relationships
Number of op = COUNTROWS(factTable) Number of op -6h = CALCULATE(COUNTROWS(factTable),USERELATIONSHIP(dimTable[start date/time],factTable[Date - 6h])) - NoelleHelper I
Thank you Anonymous . I must do something wrong, since I keep getting the same result 😞
Relationships :
Main : 'DATE DE PRODUCTION'[Date]->'Feuil1'[Date]
Second : 'DATE DE PRODUCTION'[Date]->'Feuil1'[Date -6]
Nbre de Rx = COUNTROWS('Feuil1')Nbre de Rx -6 = CALCULATE(COUNTROWS('Feuil1'),USERELATIONSHIP('DATE DE PRODUCTION'[Date],Feuil1[Date -6]))Can you see what's my mistake?
Thanks
Noelle
- AnonymousNot applicable
Hi Noelle
I have no idea...it looks like the same, but it works in my sample file...I can send you the .pbix file if you need, you can pm your email address