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 of a measure over FY with worst month removed

Hello all,

 

I have been thinking about this measure for a while and I am stumped.

 

I have a measure that I calculating a percentage of customers who meet a criteria over all months in the current context. 

 

What I want to do is take these values then remove the worst one in each fiscal year [FY] (april to april) and then average the remaining values. So if it was a FY that has finished this would be 11 values, for the current FY (April 2018 ->  August 2018) there has been 4 months completed so I would only be averaging 3 items.

 

I currently have a measure that will produce this result correctly when only one fiscal year is selected, however when more than one FY is selected it will only remove the worst performing month from all the years, not the worst from each FY. The definition for this measure is below.

 

Measure = 
AVERAGEX (
    CALCULATETABLE (
        TOPN (
            DISTINCTCOUNT ( DateTable[StartOfMonthDate] ) - 1,
            VALUES ( DateTable[StartOfMonthDate] ),
            [Yes Percent], DESC
        ),
        FILTER ( ALLSELECTED ( DateTable ), DateTable[Date] <> BLANK () )
    ),
    [Yes Percent]
)

 

The model itself is simple, I have a fact table, with one to many relationships between a date table and a customer dim table. The relationship between customer and the fact table is bidirectional

 

 

See link below for a pbix file with dummy data.

https://www.dropbox.com/s/8kqqrc1rmnspols/Measure%20Problem.pbix?dl=0

 

Current result

 

Month&YearMeasure
Apr-1766.67%
May-1777.78%
Jun-1755.56%
Jul-17 
Aug-1780.00%
Sep-1780.00%
Oct-1780.00%
Nov-1780.00%
Dec-1770.00%
Jan-1870.00%
Feb-1880.00%
Mar-1880.00%
Apr-1880.00%
May-1870.00%
Jun-1860.00%
Jul-1890.00%

 

Expected Result

Month&YearMeasure
Apr-1766.67%
May-1777.78%
Jun-1755.56%
Jul-17 
Aug-1780.00%
Sep-1780.00%
Oct-1780.00%
Nov-1780.00%
Dec-1770.00%
Jan-1870.00%
Feb-1880.00%
Mar-1880.00%
Apr-1880.00%
May-1870.00%
Jun-18 
Jul-1890.00%

 

As described earlier, the measure I currently have is only removing the lowest value, not the lowest value in each FY

 

Thank you for your help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I managed to solve the problem by creating a ranking measure that ranks within each fiscal year and then averagex over a virtual table removing any items with the lowest rank.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

TOPN (
            DISTINCTCOUNT ( DateTable[StartOfMonthDate] ) - 1,
            VALUES ( DateTable[StartOfMonthDate] ),
            [Yes Percent], DESC
        )

this just remove the worst performing month from the table you selected,

you need to group data by fiscal year and then remove the worst performing month for each fiscal year.

 

Best Regards,

Lin

 

 

 

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

I managed to solve the problem by creating a ranking measure that ranks within each fiscal year and then averagex over a virtual table removing any items with the lowest rank.

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.