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

Calculating Average Total and Percentage Total

Hi All,

I am working on a Matrix table looking for solution, how find Average total & percentage from Feb to Jun, based on this i have another Donut Chart


Avg.PNG

 

Donut chart using Total Average from Feb to Jun

Donut.PNG

Thank you

 

Regards,

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @harirao ,

 

I think you in data model [Feb-23]...[Jun-23] should all be columns as below.

RicoZhou_0-1675150629733.png

This will make our calculation difficult and I suggest you to try UNPIVOT function to transform your table.

Select [Item.[DP Manager]] column and unpivot other columns. Then remove blank values in [Value] column.

For reference: Unpivot columns - Power Query | Microsoft Learn

RicoZhou_1-1675151264452.png

Then average measure shoule be as below.

Count = CALCULATE(COUNT('Table'[Value]))
Percentage of Total =
VAR _Total =
    CALCULATE ( [Count], ALLEXCEPT ( 'Table', 'Table'[Item.[DP Manager]]] ) )
RETURN
    DIVIDE ( [Count], _Total )

Result is as below.

RicoZhou_2-1675151275348.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @harirao ,

 

I think you in data model [Feb-23]...[Jun-23] should all be columns as below.

RicoZhou_0-1675150629733.png

This will make our calculation difficult and I suggest you to try UNPIVOT function to transform your table.

Select [Item.[DP Manager]] column and unpivot other columns. Then remove blank values in [Value] column.

For reference: Unpivot columns - Power Query | Microsoft Learn

RicoZhou_1-1675151264452.png

Then average measure shoule be as below.

Count = CALCULATE(COUNT('Table'[Value]))
Percentage of Total =
VAR _Total =
    CALCULATE ( [Count], ALLEXCEPT ( 'Table', 'Table'[Item.[DP Manager]]] ) )
RETURN
    DIVIDE ( [Count], _Total )

Result is as below.

RicoZhou_2-1675151275348.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.