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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Syndicate_Admin
Administrator
Administrator

Optimize Measurement

Hello everyone

I am trying to generate a measure such that it tells me the number of materials that make up the 80% of sales given a segment for all customers, then when filter by customer I indicate how many materials that customer has assigned are within the 8020 materials previously calculated. I have found a solution but the measurement takes a long time to calculate, so I try to optimize it. The measure is:

Measure =
VAR Amount Earned = CALCULATE(Measures[Measure Amount Earned], ALLSELECTED(Billing[Segment]),ALLSELECTED(Billing[Customer]))
VAR Table1 = CALCULATETABLE(FILTER(VALUES(Facturacion[Material]),DIVIDE(SUMX(TOPN(Measures[Measure Rank],CALCULATETABLE(VALUES(Facturacion[Material]),ALLSELECTED(Facturacion[Material])),[Measure Amount Earned]),Measures[Measure Amount Earned]),IF(NOT(ISBLANK(AmountEarned)),CALCULATE([Measure Amount Earned],ALLSELECTED(Invoice[Material]))))<0.8),ALL(Billing[Customer]))
VAR MedidaNumeroMateriales8020_Total = COUNTROWS(Table 1)
VAR Table2 = FILTER(CALCULATETABLE(FILTER(VALUES(Facturacion[Material]),DIVIDE(SUMX(TOPN(Measures[Measure Rank],CALCULATETABLE(VALUES(Facturacion[Material]),ALLSELECTED(Facturacion[Material])),[Measure Amount Earned]),Measures[Measure Amount Earned]),IF(NOT(ISBLANK(AmountEarned)),CALCULATE([Measure Amount Earned],ALLSELECTED(Invoice[Material]))))<0.8),ALL(Billing[Customer]),Measures[Measure Amount Earned]>0)
VAR MedidaNumeroMateriales8020_Cliente = COUNTROWS(Table2)
RETURN
DIVIDE(MedidaNumeroMateriales8020_Cliente,MedidaNumeroMateriales8020_Total)

where we only take a measure called Rank Measure that was calculated previously defined as:

Measure Rank = IF(HASONEVALUE(Billing[Material]),RANKX(ALL(Billing[Material]),Measures[Measure Amount Earned]),BLANK())

as I optimize the measure since when inegrar everything, that is, placing the rank measure within the measure of the calculation gives me different values or if there is any different way to achieve that the measure was calculated faster

1 REPLY 1
foodd
Community Champion
Community Champion

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.