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.
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 # | Type | Product | Price |
Deal 1 | Renewal | Product A | 10 |
Deal 1 | New | Product B | 20 |
Deal 1 | Renewal | Product C | 40 |
Deal 1 | New | Product D | 60 |
Deal 2 | New | Product E | 15 |
Deal 2 | Renewal | Product F | 35 |
Deal 2 | New | Product G | 40 |
Deal 2 | Renewal | Product H | 24 |
Solved! Go to Solution.
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:
here is sample pbix file, please try it.
Regards,
Lin
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:
here is sample pbix file, please try it.
Regards,
Lin
Hi,
You may download my PBI file from here.
Hope this helps.
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])
@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.
Hi @Anonymous ,
Try creating this measure:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
97 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |