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
Anonymous
Not applicable

AVERAGE

1.PNG HOW CAN I GET THE AVERAGE OF THE 3 HIGHLIGHTED ROWS.

10 REPLIES 10
Phil_Seamark
Employee
Employee

Hi @Anonymous

 

A rolling 3 month average or a hardcoded measure to give you the average to those specific days?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

@Phil_Seamark yes, just the average of those 3 numbers. The numbers are already the way I need them to be, I just need to average those 3. I've tried a AVERAGEX function with it which gets me really close, but for some reason the function changes the numbers slightly for certain months, making the overall average incorrect:

1.PNG 

The Month End column comes from my date table, my retention and last quarter retention is coming from my fact table. So with the above formula, the only thing I was trying to accomplish was averaging the 3 highlighted values in my [retention] column. So (87.08+87.59+87.46)/3 which should give 87.38. Instead, it is returning (87.03+87.54+87.54)/3 which gives the 87.36. I'm not sure why it is changing my original [retention] values. I know it is a very very small difference, but boss man only wants to accept perfect...

@Anonymous -

 

Be aware that mathematically, averaging values that are already ratios themselves is not correct, unless all of the ratio's denominators are exactly the same.  For example

 

Q1 - 25/100 = .25

Q2 - 20/200 = .10

Q3 - 50/100 = .50

 

(.25 + .10 + .50) / 3 = .2833

 

but Average(Q1 thru Q3) = (25+20+50) / (100+200+100) = .2375

 

So this may be the discrepancy in the two numbers - try recalculating Last Quarter Retention by using the same formula with which you calculate the monthly retention, but sum up the numerators and denominators before dividing.

 

Hope this helps

David

 

 

 

Anonymous
Not applicable

@dedelman_clng I'm not sure how I would do that. Here are the pieces to my retention formula:

1.PNG


1.PNG

 

1.PNG

 

1.PNG

 

So my numerator is [Active]-[Added]. I get what you are saying, I'm just a bit novice in my PBI skills to put together what you've said.

@Anonymous -

 

I think you are going to want to essentially recreate the 3 measures used for retention, but with the "last quarter" filter you were using in AVERAGEX.  So create

 

[LQ Added]

[LQ Active]

[LQ Starting]

 

and then your [LQ Retention] is essentially the same formula

 

( [LQ Added] - [LQ Active] ) / [LQ Starting]

 

 

 

Anonymous
Not applicable

@dedelman_clng This puts me back to a place I was at previously:

1.PNG 

 

It is only returning the last value of the last month of quarter 1. It is not taking february or january into the formula. This is what each individual formula looks like:

1.PNG

@Anonymous - because you have competing filters in [Active] and [LQ Active], you will likely have to redo the calculation part of [Active] (DISTINCTCOUNT) in [LQ Active] (rather than referring to the other measure).

 

Also, you may need to "clear" the filters from DATE when calculating the LQ measures (since you're showing the data in table, the measure will inherit the implicit filter from the table

 

...FILTER(ALL('Date'), 'Date[Year]'=2018...)

 

Time intelligence is always tricky in DAX/PowerBI - I have found that often you have to resort to building calculations for time comparisons twice.

Anonymous
Not applicable

@dedelman_clng I think I see. So my LQ Active would look something like:

LQ Active = CALCULATE(DISTINCTCOUNT(M3[co]),FILTER(M3,M3[startDate]<=MAX('Date'[Date])&&M3[enddate]>=MAX('Date'[Date])),FILTER(ALL('Date'),'Date'[Year]=2018&&'Date'[Quarter]="Qtr 1")))

 

 

Yes - looks like you're on the right track

Anonymous
Not applicable

@dedelman_clng I see. I will give it a try and let you know the outcome! Thank you for the advice.

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.