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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
f1254lipm
Frequent Visitor

Bottom 10th product sales amount value optimization

Hi, I need a little bit of help to optimize a measure that always gets the 10th bottom product sales amount and reacts to only specified filters. I created the measure on sample columns and data so I can show the current measure definition. The measure is used for example in a table visual where only the top 5 customers by sales amount are filtered but I don't want the 10th bottom product sales amount value to be affected (filtered) by the top 5 customers filter or any other filters with the exception of a filter that I defined in the measure (in this case Education) because the value of the measure is then used in another measure where I add this value to value of other simple sum measure. Is there a way to optimize this measure and at the same time keep the described behaviour.

Thanks

 

The measure:

Nth-Product Sales Amount Dense =
VAR ReferenceProducts = ALL ( DimProduct[ProductKey])
VAR ProductsAndSales =
    ADDCOLUMNS (
        ReferenceProducts,
        "Rank", RANKX (
            ALL ( DimProduct[ProductKey]),
            CALCULATE(CALCULATE([SalesAmmount],ALL(FactInternetSales),VALUES(DimProduct[ProductKey]),VALUES(DimCustomer[EnglishEducation]))),
            CALCULATE(CALCULATE([SalesAmmount],ALL(FactInternetSales),VALUES(DimProduct[ProductKey]),VALUES(DimCustomer[EnglishEducation]))),
            ASC,
            Dense
        )
    )
VAR FilterNthProduct = FILTER ( ProductsAndSales, [Rank] = 10 )
VAR NthAmount = MINX ( FilterNthProduct, CALCULATE(CALCULATE([SalesAmmount],ALL(FactInternetSales),VALUES(DimProduct[ProductKey]),VALUES(DimCustomer[EnglishEducation]))))
RETURN NthAmount

 

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors