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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Tomas_Seig
Frequent Visitor

Calculate Mode Range (the most common values within a range)

Hi all,

 

Thank you very much in advance for your support.

I am trying to calculate given a list of prices, the Mode within a 20EUR range so as to say, the most common price is between 120-140EUR.

 

To calculate the Mode I am using the measure:

MINX (
    TOPN (
        1,
        ADDCOLUMNS (
            VALUES ( Data[Value] ),
            "Frequency", CALCULATE ( COUNT ( Data[Value] ) )
        ),
        [Frequency],
        0
    ),
    Data[Value]
)

Any ideas how to add 20 or subract 20 or any possible combination in between that would include the most hits?

Kind Regards,

Tomas

 

 

1 ACCEPTED SOLUTION
Tomas_Seig
Frequent Visitor

Solved like this:

RANGE = COUNTROWS(FILTER(FT_SALES_TRADING_BI,(FT_SALES_TRADING_BI[PRICE]>= EARLIER(FT_SALES_TRADING_BI[PRICE]) && FT_SALES_TRADING_BI[PRICE] < EARLIER(FT_SALES_TRADING_BI[PRICE]) +20 )))

View solution in original post

3 REPLIES 3
Tomas_Seig
Frequent Visitor

Solved like this:

RANGE = COUNTROWS(FILTER(FT_SALES_TRADING_BI,(FT_SALES_TRADING_BI[PRICE]>= EARLIER(FT_SALES_TRADING_BI[PRICE]) && FT_SALES_TRADING_BI[PRICE] < EARLIER(FT_SALES_TRADING_BI[PRICE]) +20 )))
daXtreme
Solution Sage
Solution Sage

Any ideas how to add 20 or subract 20 or any possible combination in between that would include the most hits?

 

What do you mean by this? Calculating the mode(s) is rather simple. For each value in your set you just look at the number of any specific values and the one(s) that are/is the most frequent are/is the mode(s).

Sorry, I dont think I explained myself correctly. What I need is the most common subset of prices with length 20.

 

So, given a list of 100 sales, count how many fall within a 20EUR range and get the range with the highest count.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.