cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
dolevh
Helper II
Helper II

Average 4 week same week day

Hi everyone,
I want to produce a function that will make me an average of the number of users each month of all days of the week (Sunday until Saturday)
For example:
The average of Sundays in July is X
The average of Mondays in July is y
The average of Tuesdays in July is Z 

 

Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@dolevh So, have to make some assumptions because no sample source data, but perhaps something like:

Measure = 
  VAR __Date = MAX('Table'[Date)
  VAR __Weekday = WEEKDAY(__Date)
  VAR __Month = MONTH(__Date)
  VAR __Year = YEAR(__Date)
  VAR __Table = FILTER(ALL('Table'),[Year]=__Year && [Month]=__Month && [Weekday]=__Weekday)
RETURN
  DIVIDE(
    SUMX(__Table,[Value]),
    COUNTROWS(__Table),
    0
  )

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@dolevh So, have to make some assumptions because no sample source data, but perhaps something like:

Measure = 
  VAR __Date = MAX('Table'[Date)
  VAR __Weekday = WEEKDAY(__Date)
  VAR __Month = MONTH(__Date)
  VAR __Year = YEAR(__Date)
  VAR __Table = FILTER(ALL('Table'),[Year]=__Year && [Month]=__Month && [Weekday]=__Weekday)
RETURN
  DIVIDE(
    SUMX(__Table,[Value]),
    COUNTROWS(__Table),
    0
  )

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors