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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
OneHotEncoder
Frequent Visitor

Build average value of 30 min time interval

Dear community,

 

I have the following table existing of a column with time stamps (data type: Time, format hh:mm:ss) and the counted amount of sold goods (whole numbers). Example table:

 

 

Time Stamp             Sold Goods

18:25:50                         1

07:21:05                         3

11:45:35                         2

....                                   ...

 

I now want to create a query which calculates the average amount of sold goods per 30 min interval.

Output would then be:

 

Time interval            Average amount of sold goods

07:00 - 07:30                                  5

07:30 - 08:00                                  3

08:00 - 08:30                                  2

...                                                    ....

 

I tried with the following DAX code which should solve the problem:

 

Averageby30min =
    VAR TimeIntervals =
        GENERATE(
            SUMMARIZE('TableName', 'TableName'[Time Stamp]),
            SELECTCOLUMNS(
                SUMMARIZE('TableName', 'TableName'[Time Stamp]),
                "@StartTime", TIME(HOUR('TableName'[Time Stamp]), FLOOR(MINUTE('TableName'[Time Stamp]) / 30) * 30, 0),
                "@EndTime", TIME(HOUR('TableName'[Time Stamp]), FLOOR(MINUTE('TableName'[Time Stamp]) / 30 + 1) * 30, 0)
            )
        )
    RETURN
        AVERAGEX(
            SUMMARIZE(TimeIntervals, [@StartTime], [@EndTime]),
            CALCULATE(
                SUM('TableName'[Time Stamp]),
                'TableName'[ime Stamp] >= [@StartTime] && 'Query1'[book_substring] < [@EndTime]
            )
        )

 

 

Im always getting the following error code:

Too few arguments were passed to the FLOOR function. The minimum argument count for the function is 2.

 

Has anyone already solved this issue or know the error?

 

Thank you very much.

 

 

 

 

 

 

1 REPLY 1
lbendlin
Super User
Super User

As the documentation to FLOOR states you must indicate what you want to round to.  In your case should be 1.
 
Usually these kinds of calendars should be created further upstream, in Power Query or in an external calendar table.

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