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
Josuep
Frequent Visitor

Average of sales per day in a table

Hi all,   in below chart I have the total sales per office for a timeframe of 3 months:

 

Josuep_0-1676673469236.png

 

along with this chart I also have a slicer that adjusts the timeframe to specific date ranges.

 

I need to add a chart that indicates the average sales per day per office, and that also can be adjusted with the slicer.

How can I do this?

 

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Josuep Well, let's say your measure is "Sales", you could do this:

Average Sales Per Day Measure =
  VAR __MinDate = MIN('Dates'[Date])
  VAR __MaxDate = MAX('Dates'[Date])
  VAR __Days = ( __MaxDate - __MinDate ) * 1.
  VAR __Sales = [Sales]
  VAR __Result = DIVIDE( __Sales, __Days, 0)
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

thanks for your reply, I tried it but the formula is failing on this line:  VAR _Sales = [Sales].  I presume this is because Sales is not a measure but a column in my data base.  How can I solve this?

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.