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
Anonymous
Not applicable

Measure - Average percent

Hello Community -  I have a table, with Team names and month, and margin.  

 

Ideally, I need a table that can filtered at the year, quarter, and month level  (so dynamically will adjust dependin on what hierarchy level).    Secondly, I need the columns to come to a "total" average.    The row totals already do this...but the column "totals" do not.   If add the monthly amounts...and divide by 9 (months), the row totals work fine.    But if you add the columns up, they do not come to the correct "average".  

 

I am using the measure below, but in summmary, I simply want to be able to put a measure on this visual that gives me the average margin amounts, by Team, and by whatever date hierarchy is selected.   It should also dynamically adjust to whatever Teams are selected.    

 

Here is my main margin measure:   

Net Shipped Margin % = DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)

 

texmexdragon_0-1633090884260.png

 
And this one I made specifically to see the month...but ideally I need this to be dynamic to change with the date hiearchy. 
 
Monthly Average of Net Shipped Margin % = AVERAGEX(
SUMMARIZE('Dim_Date Table',
'Dim_Date Table'[Month Name],
"Average", DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)
),
[Average]
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to use isinscope and change measure in switch

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

Monthly Average of Net Shipped Margin % =

Switch(true() ,

isinscope('Dim_Date Table'[Month Name]),

AVERAGEX(
SUMMARIZE('Dim_Date Table',
'Dim_Date Table'[Month Name],
"Average", DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)
),
[Average]
)

,

AVERAGEX(
SUMMARIZE('Dim_Date Table',
'Dim_Date Table'[Date],
"Average", DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)
),
[Average]
)

)

 

 

add conditions as per need

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , You need to use isinscope and change measure in switch

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

Monthly Average of Net Shipped Margin % =

Switch(true() ,

isinscope('Dim_Date Table'[Month Name]),

AVERAGEX(
SUMMARIZE('Dim_Date Table',
'Dim_Date Table'[Month Name],
"Average", DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)
),
[Average]
)

,

AVERAGEX(
SUMMARIZE('Dim_Date Table',
'Dim_Date Table'[Date],
"Average", DIVIDE([Net Shipped Margin $], [Net Shipped Revenue],0)
),
[Average]
)

)

 

 

add conditions as per need

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.