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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Human
Frequent Visitor

Help with volume used for the day

Hi, I want to create a calculated column where it could calculate the usage of the volume for the day. I was hoping that it could subtract the volume reading from the start of the day with the end of the day at a specific time (06:30:00 at the morning and 11:30:00 at night) and display the result in the calculated column.

 

Human_0-1697104449081.png

The volume used per day is the column that I am aiming to create. Please help..

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @Human possible solution: create calculated column as request like below, adjust Sheet1 to your table name

 

Volume used per day =
VAR __current_time = Sheet1[timestamp ]
VAR __start_of_day =
    DATE ( YEAR ( Sheet1[timestamp ] ), MONTH ( Sheet1[timestamp ] ), DAY ( Sheet1[timestamp ] ) )
        + TIME ( 6, 30, 0 )
VAR __end_of_day =
    DATE ( YEAR ( Sheet1[timestamp ] ), MONTH ( Sheet1[timestamp ] ), DAY ( Sheet1[timestamp ] ) )
        + TIME ( 23, 30, 0 )
VAR __volume_start_day =
    CALCULATE (
        SUM ( Sheet1[Volume] ),
        FILTER ( ALL ( Sheet1 ), Sheet1[timestamp ] = __start_of_day )
    )
VAR __volume_end_day =
    CALCULATE (
        SUM ( Sheet1[Volume] ),
        FILTER ( ALL ( Sheet1 ), Sheet1[timestamp ] = __end_of_day )
    )
RETURN
    IF ( __current_time = __end_of_day, __volume_start_day - __volume_end_day, 0 )
 

Did I answer your question? Kudos appreciated / accept solution!

some_bih_0-1697113546918.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

2 REPLIES 2
some_bih
Super User
Super User

Hi @Human possible solution: create calculated column as request like below, adjust Sheet1 to your table name

 

Volume used per day =
VAR __current_time = Sheet1[timestamp ]
VAR __start_of_day =
    DATE ( YEAR ( Sheet1[timestamp ] ), MONTH ( Sheet1[timestamp ] ), DAY ( Sheet1[timestamp ] ) )
        + TIME ( 6, 30, 0 )
VAR __end_of_day =
    DATE ( YEAR ( Sheet1[timestamp ] ), MONTH ( Sheet1[timestamp ] ), DAY ( Sheet1[timestamp ] ) )
        + TIME ( 23, 30, 0 )
VAR __volume_start_day =
    CALCULATE (
        SUM ( Sheet1[Volume] ),
        FILTER ( ALL ( Sheet1 ), Sheet1[timestamp ] = __start_of_day )
    )
VAR __volume_end_day =
    CALCULATE (
        SUM ( Sheet1[Volume] ),
        FILTER ( ALL ( Sheet1 ), Sheet1[timestamp ] = __end_of_day )
    )
RETURN
    IF ( __current_time = __end_of_day, __volume_start_day - __volume_end_day, 0 )
 

Did I answer your question? Kudos appreciated / accept solution!

some_bih_0-1697113546918.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thank you very much @some_bih !!.. this is exactly the solution that I've been aiming..

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors