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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Displaying Weekly Avg sales in Hour Bucketing

Hi Experts,

 

My requirements is show Avg daily sales weekly and avg daily sales todate in hourly bucket(11am to 1 pm and 1 pm to 3 pm).

 

something like below

 

1.JPG

 

1 ACCEPTED SOLUTION

Try like

calculate(AVERAGEX (summarize(calculatetable('Calendar',datesytd('Calendar'[Date]))
    ,'Calendar'[Date],"_sales",[Sales Rev]),[_sales]))

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous ,

 

Can you provide sample data sample output

 

Anonymous
Not applicable

@amitchandak  sir,

 

Here is my sample data. i also need to calculate avg sales todate daily

 

Avg Sales Per Day =
AVERAGEX (
VALUES('Calendar'[Date]),[Sales Rev])
 
Hour Bucket =
SWITCH (
TRUE (),
HOUR ( Timestamp[timestampUTC] )
+ MINUTE ( Timestamp[timestampUTC] ) / 60 >= 11
&& HOUR ( Timestamp[timestampUTC] )
+ MINUTE ( Timestamp[timestampUTC] ) / 60 < 13, "11:00 a.m. - 1:00 p.m.",
HOUR ( Timestamp[timestampUTC] )
+ MINUTE ( Timestamp[timestampUTC] ) / 60 >= 13
&& HOUR ( Timestamp[timestampUTC] )
+ MINUTE ( Timestamp[timestampUTC] ) / 60 < 15, "1:00 p.m. - 3:00 p.m."
)

 

Capture.JPG

 

Hi @Anonymous ,

Have you tried the formula which amitchandak suggests? If yes, please mark the answer as a solution. If you still have problems, please share the image again. It is not working.

 

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-xuding-msft  yes it is working. thanks

 

Try like

calculate(AVERAGEX (summarize(calculatetable('Calendar',datesytd('Calendar'[Date]))
    ,'Calendar'[Date],"_sales",[Sales Rev]),[_sales]))

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.