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

Average Subcategory sums

Hi,

 

I am looking to average the sum of a subcategory within a column in my dataset. See below for an example. I am looking to find the average deal size for renewals/new and display that measure in a card. In other words, the average renewal deal size measure should calculate ((10+40)+(35+24))/2 which would equal 54.5. I have thought about making a calculated table which summarize each deal and go that way but I would prefer this be done in one DAX measure. I've attached a link to a dummy dataset. Thank you in advance.  

 

https://www.dropbox.com/s/c43c65d11m07exo/Dummy%20Data.pbix?dl=0

 

Deal #TypeProductPrice
Deal 1RenewalProduct A10
Deal 1NewProduct B20
Deal 1RenewalProduct C40
Deal 1NewProduct D60
Deal 2NewProduct E15
Deal 2RenewalProduct F35
Deal 2NewProduct G40
Deal 2RenewalProduct H24
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

For your case, you could try these two way:

1. Create two measure as below:

Renewal avg = 
var _table=SUMMARIZE(FILTER(Sheet1,Sheet1[Type]="Renewal"),Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])
New avg = 
var _table=SUMMARIZE(FILTER(Sheet1,Sheet1[Type]="New"),Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])

Then drag them into card visual.

 

2. create a measure and the drag type and it into a table visual

avg =
var _table=SUMMARIZE(Sheet1,Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])

 

Result:

7.JPG

 

here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
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

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

For your case, you could try these two way:

1. Create two measure as below:

Renewal avg = 
var _table=SUMMARIZE(FILTER(Sheet1,Sheet1[Type]="Renewal"),Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])
New avg = 
var _table=SUMMARIZE(FILTER(Sheet1,Sheet1[Type]="New"),Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])

Then drag them into card visual.

 

2. create a measure and the drag type and it into a table visual

avg =
var _table=SUMMARIZE(Sheet1,Sheet1[Deal #],Sheet1[Type],"_value",CALCULATE(SUM(Sheet1[Price]))) return
AVERAGEX(_table,[_value])

 

Result:

7.JPG

 

here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

Seems like:

 

Renewal Measure = AVERAGEX(SUMMARIZE(FILTER('Table',[Type] = "Renewal"),[Deal #],"__Total",SUM('Table'[Price])),[__Total])

 

New Measure = AVERAGEX(SUMMARIZE(FILTER('Table',[Type] = "New"),[Deal #],"__Total",SUM('Table'[Price])),[__Total])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Anonymous you can always achieve this with one measure and filter on any type

 

Avg Measure = AVERAGEX ( VALUES ( 'Table'[Deal #] ), CALCULATE( SUM ( 'Table'[Price] ) ) )

Avg Renewal = CALCULATE( AVERAGEX ( VALUES ( 'Table'[Deal #] ), CALCULATE( SUM ( 'Table'[Price] ) ) ), 'Table'[Type] = "Renewal" )

Avg New = CALCULATE( AVERAGEX ( VALUES ( 'Table'[Deal #] ), CALCULATE( SUM ( 'Table'[Price] ) ) ), 'Table'[Type] = "New" )

 

for single measure (Avg Measure), just use table visual and put type and avg measure in the visual, and it will show avg specific to the type. it is more scalable in case you have more types in the future. Would appreciate Kudos 🙂 if my solution helped. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try creating this measure:

Measure = DIVIDE(SUMX(SUMMARIZE(FILTER('Table'; 'Table'[Type] = "Renewal"); 'Table'[Deal #]; 'Table'[Price]); 'Table'[Price]); CALCULATE(DISTINCTCOUNT('Table'[Deal #]); 'Table'[Type] = "Renewal"))
 
Capture.PNG
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.