cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper II

## Calculate average based on same category

Hi Everyone,
Good day!
As per the below snapshot I want to create a new measure where the marked percentage numbers should get averaged beacuse it lies under the same category of column A but column B is divided into sub category so, I have to average those numbers but in the total section it should take one percentage (like 40.00% + 53.33% = 46.66% but in the total average calcualtion it should be considered once  .

Margin formula = c-d/d

Sumesh

1 ACCEPTED SOLUTION
Super User

Hi,

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
6 REPLIES 6
Impactful Individual

hello @SUMESHKUMAR22 ,

``margin average = CALCULATE(AVERAGE(powerbi[Margin]),ALLEXCEPT(powerbi,powerbi[a]))``

Helper II

Hi @eliasayy ,
This is coming up fine at category level. But in the total average instead of 49.56% it should come up 48.70%. That is dividng the average by distinct table[a] values.

Thanks you!

Super User

@SUMESHKUMAR22 Try:

``````Measure =
VAR __a = SELECTCOLUMNS('Table'[a])
VAR __Result =
AVERAGEX(
SUMMARIZE(FILTER(ALL('Table'),[a] IN __a),[a],[b], "__T_margin%",[T_margin%]),
[__T_margin%]
)
RETURN
__Result``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Helper II

Hi @Greg_Deckler ,
Thanks for prompt response!
The final total avergae should come up 48.70% instead of 49.56% . As we will not consider the repetitve percentage values as per the Table[a] disitnct values.

Helper II

Hi @Greg_Deckler , @eliasayy

Below is the total average (Result), I'm expecting in your above measure.
The blank that is coming shouldn't come up and give the total result as 48.70% .

Super User

Hi,

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors