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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.