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
ovonel
Post Prodigy
Post Prodigy

Get averaged weight for subtotals?

I am unable to get a proper weighted average. I have revenue data... The way I am doing it:

 

 

RevExclu =
CALCULATE (
    SUM ( Revenue[Revenue] ),
    FILTER ( 'Sectors', NOT 'Sectors'[Sec] IN { "xyz", BLANK () } )
)

(I have to exclude some revenue)

 

 

Then I get the total per UP:

TotalPerUP =
SUMX ( SUMMARIZE ( Revenue, 'Customer'[UP] ), [RevExclu] )

 

 

Then I get the max Sec per UP. (doesn’t matter which Sec, but the revenue sum value).

MaxSecPerUP =
MAXX ( SUMMARIZE ( Revenue, 'Customer'[UP], 'Sectors'[Sec] ), [RevExclu] )

 

Then I get the metric which Is total/max:

MetricUp =
DIVIDE ( [TotalPerUP], [MaxSecPerUP], BLANK () )

 

Then; I should go one level up and do the the weigthed average of this metric… Should be SUM( metric x size)  / Total

 

The upper level is Lead (each Lead has many UPs)

 

I have the total:

TotalPerLead =
SUMX ( SUMMARIZE ( Revenue, 'Lead'[Lead] ), [RevExclu] )

Now I need to go each UP by UP and do  (Metric x Size) (and then do a SUM of all that...)

 

That is, go UP by UP and do [TotalPerUP]*[MetricUp]


(I have only achieved it using ALLEXCEPT, but I would prefer not using it since it removes my filters…) How can I do it?

 

1 REPLY 1
amitchandak
Super User
Super User

@ovonel ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.

Top Solution Authors