The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hey all,
Im trying to sum the values between Today's and yesterday's date between 07:00 and 07:00 (7 am to 7 am).
sample data:
Datetime | Value |
10/6/2020 6:05 | 5610 |
10/6/2020 8:05 | 1103 |
10/6/2020 9:05 | 7313 |
10/6/2020 10:05 | 5961 |
10/6/2020 11:05 | 1798 |
10/6/2020 12:05 | 1849 |
10/6/2020 13:05 | 1231 |
10/6/2020 14:05 | 7773 |
10/6/2020 15:05 | 9199 |
10/6/2020 16:05 | 1439 |
10/6/2020 17:05 | 7551 |
10/6/2020 18:05 | 7546 |
10/6/2020 19:05 | 9752 |
10/6/2020 20:05 | 438 |
10/6/2020 21:05 | 3461 |
10/6/2020 22:05 | 7773 |
10/6/2020 23:05 | 761 |
11/6/2020 0:05 | 2809 |
11/6/2020 7:05 | 3666 |
Thanks for your help,
Ariel
Solved! Go to Solution.
Hi @Anonymous
Try this measure
Measure =
VAR __end = TODAY() + TIME( 7, 0, 0 )
VAR __start = __end - 1
RETURN
CALCULATE(
SUM( 'Table'[Value] ),
KEEPFILTERS(
'Table'[Datetime] >= __start &&
'Table'[Datetime] < __end
)
)
the result based on your sample will be.
Hello @Anonymous ,
I suggest you to add new Date column to your data table
Date = FORMAT('Time Table'[DateTime], "mm/dd/yyyy")
After that, you can create the following Total measure
Total =
VAR timeSlicer =
FORMAT ( TIME ( 7, 0, 0 ), "hh:mm:ss" ) //set your time here
VAR currentDay =
SELECTEDVALUE ( 'Time Table'[Date] ) + timeSlicer
VAR prevDay = currentDay - 1
VAR result =
CALCULATE (
SUM ( 'Time Table'[Value] ),
FILTER (
ALL ( 'Time Table' ),
'Time Table'[DateTime] < currentDay
&& 'Time Table'[DateTime] >= prevDay
)
)
RETURN
result
To see the result - drag the new Date column and Total measure into a table
Hey @Hennadii,
I tried your solution but it didn't work - It didn't show me any values.
I copied your steps and still it didn't work 😞
I really appreciate your help anyways!
Ariel
Hi @Anonymous
Try this measure
Measure =
VAR __end = TODAY() + TIME( 7, 0, 0 )
VAR __start = __end - 1
RETURN
CALCULATE(
SUM( 'Table'[Value] ),
KEEPFILTERS(
'Table'[Datetime] >= __start &&
'Table'[Datetime] < __end
)
)
the result based on your sample will be.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
82 | |
77 | |
48 | |
39 |
User | Count |
---|---|
150 | |
117 | |
67 | |
64 | |
56 |