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
joshcomputer1
Helper V
Helper V

YTD average by Day of Week

Hi there,

 

I am wanting to get an average for the day of the week, YTD.  The data is situated like the chart on the left. I want the chart on the right. Then, I have a date filter on the page too, so the user selects a date and it filters that date. I need it to not be filtered by the date filter.  I think I can turn off the edit interactions with the filter. If I can do this with just a measure, that would be ideal.  I do have a date table named date[date]. 

 

This is what I have so far, but it doesn't have the YTD averaged in it.

AVG CAlls By DOW = calculate(average(table1[Count]), groupby(table1, table1[DOW]))

 

ss1.PNG

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @joshcomputer1,

Based on my test, you could refer to below formula:

Measure = CALCULATE(AVERAGE(Data[Count]),FILTER(ALL('Data'),'Data'[DOW]=MAX('Data'[DOW])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-danhe-msft
Employee
Employee

Hi @joshcomputer1,

Based on my test, you could refer to below formula:

Measure = CALCULATE(AVERAGE(Data[Count]),FILTER(ALL('Data'),'Data'[DOW]=MAX('Data'[DOW])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

  1. In a Table visual, drag DoW in the Row labels
  2. Write this measure

=CALCULATE(AVERAGE(Data[Count]),ALL(Data[Date]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I cannot do the DOW as the legend in my setup. The user will select a date and the card needs to pick up the DOW from the date selected, then give the average for that day YTD. When I use that measure (see the card on the right), what it shows is the average for the date selected in the slicer. I think the DAX needs to include something with DOW.  

 

ss1.PNG

 

Hi,

 

Try this measure

 

=CALCULATE(AVERAGE(Data[Count]),DATESBETWEEN(Calendar[Date],DATE(2018,1,1),MAX(Calendar[Date])),FILTER(Data,Data[Dow]=MAX(Data[DoW])))

 

There should be a Calendar Table with a relatiosnhip from the Date column of the Data Table to the Date column of the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This is close.  The measure shows the average count by DOW, however, The date filter is still filtering date and not just DOW. Is there a way to adjust this so that when a date is selected, the DOW is filtered, but date is not?

 

**I do have a calendar table named datetable[date] and it has a relationship to the data table. 

 

=CALCULATE(AVERAGE(Data[Count]),DATESBETWEEN(Calendar[Date],DATE(2018,1,1),MAX(Calendar[Date])),FILTER(Data,Data[Dow]=MAX(Data[DoW])))

 

Hi,

 

Share the link from where i can download your PBI file.  In that file, please select any one date and your expected answer.  When i write my DAX formula, i will compare my result with yours.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.