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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mega82
New Member

Average sales by weekday not working

Hi everyone, I'm trying to summarize the data as an average per day of the week and by product (see graph) but at the moment I can only do this with the totals of a given period (in the graph I have the data of one full month).

The actual result I'm looking for is to have the same graph but with the average sales by day of the week of a given period (defined by a slicer). The problem is that when I put Average in in the Value... the numbers are really low compare to the actual numbers that should show up.

I think I will have to group the data with a Calculate function or a group by but I don't seem to find the correct way of doing so.

 

Can anyone help me with this? ... I attached the table so you guys can see the type of data I'm using.

Thanks in advance for your help.

 

Capture 2.JPGCapture.JPG

 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

@Mega82

 

If I understand you correctly, you are wanting to show the average sum of Gals per day, grouped by weekday/product (as per your column chart).

 

For example if there were four Fridays in the selected period, where the sum of DIESEL Gals on each of those Fridays was 4000, 5000, 6000 and 7,000, you would expect to see Friday/DIESEL column = (4,000+5,000+6,000+7,000)/4 = 5,500.

 

A measure that would achieve this is:

 

Average of Daily Gals =
AVERAGEX (
    VALUES ( Recons_Sales_Details[Fecha] ),
CALCULATE ( SUM ( Recons_Sales_Details[Gals] ) )
)

(change the comma to a semicolon in the above code if needed 🙂 )

 

Try placing that measure in the visual instead of Gals.

 

Please post back if that works or if you were looking for something different.

 

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

@Mega82

 

If I understand you correctly, you are wanting to show the average sum of Gals per day, grouped by weekday/product (as per your column chart).

 

For example if there were four Fridays in the selected period, where the sum of DIESEL Gals on each of those Fridays was 4000, 5000, 6000 and 7,000, you would expect to see Friday/DIESEL column = (4,000+5,000+6,000+7,000)/4 = 5,500.

 

A measure that would achieve this is:

 

Average of Daily Gals =
AVERAGEX (
    VALUES ( Recons_Sales_Details[Fecha] ),
CALCULATE ( SUM ( Recons_Sales_Details[Gals] ) )
)

(change the comma to a semicolon in the above code if needed 🙂 )

 

Try placing that measure in the visual instead of Gals.

 

Please post back if that works or if you were looking for something different.

 

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thanks a lot for your response Owen. Your approach is working perfectly!!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.