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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
daniel885
New Member

Average Earliest Time by Seller by day of week

Hello all! I need help with a DAX measure that averages the latest end time of a job by seller. But I need to filter that by day of week as well.

 

I came up with this DAX measure for averaging latest end times by sellers on Wednesdays but when I do it, it takes the latest end time of each seller across all Wednesdays rather than the average across Wendesdays - so the roll up becomes the average of the latest any one seller completed work on any Wednesday rather than every Wednesday. I need the average of the latest end time PER SELLER PER DAY for just any day where it Wednesday.  I hope that makes sense! 🙂

 

Avg Latest End Time Wednesdays = VAR RESULT = AVERAGEX (VALUES ([SELLER]),
CALCULATE (MAX([ACTUAL END TIME]),[Name of Day]="Wednesday"))
RETURN IF (NOT (ISBLANK(RESULT)),RESULT+TIME(0,0,0))
 
Thanks in advance for any help you can give!

 

1 ACCEPTED SOLUTION

try like:

Avg Latest End Time Wednesdays = 

VAR RESULT = 

AVERAGEX (

     SUMMARIZE (

         TableName,

         TableName[CHID],

         TableName[Completion Date]

     ),

     CALCULATE (

          MAX([ACTUAL END TIME]),

          [Name of Day]="Wednesday"

     )

)

RETURN IF (NOT (ISBLANK(RESULT)),RESULT+TIME(0,0,0

View solution in original post

4 REPLIES 4
daniel885
New Member

Thank you! I actually just came up with another solution of joining date and sellerID together in another column and using that to take average time and that worked too! I appreciate the help. Just needed some brain storm time!

FreemanZ
Super User
Super User

seems ok. could you also provide some sample data?

Here is some of the data... I want to take the latest end times by seller (CHID) for each day then average that by day of week.  The formula above is taking the latest end time of each seller regardless of the day (so latest among all Wednesdays) and averaging that.

 

I want to

1. Take the latest end time by seller for each date

2. Average the above by day of the week

 

I tried substituting [seller] with [date] in the original formula but that didn't work. It actually gave the same result.

 

THANKS AGAIN!!

 

daniel885_0-1670883710424.png

 

try like:

Avg Latest End Time Wednesdays = 

VAR RESULT = 

AVERAGEX (

     SUMMARIZE (

         TableName,

         TableName[CHID],

         TableName[Completion Date]

     ),

     CALCULATE (

          MAX([ACTUAL END TIME]),

          [Name of Day]="Wednesday"

     )

)

RETURN IF (NOT (ISBLANK(RESULT)),RESULT+TIME(0,0,0

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors