cancel
Showing results for
Did you mean:
Regular Visitor

Calculating The Avg Price from Distinct Set of Prices

Hello PBI Guru's,

I am attempting to calculate the average price of an item where the \$ > 0 and averaged only by the distinct price and not the number of lines (records).

Image 1: Data structure

Image 2:

1. List of distinct gear charges

2. Sum of distinct gear charges

3. Correct, expected average of distinct prices.

I've searched and founda few similar posts but was not able to replicate that correct answer. Any help is greatly appreciated.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Anonymous
Not applicable

Re: Calculating The Avg Price from Distinct Set of Prices

```Calc :=
AVERAGEX (
SUMMARIZE ( 'Table', 'Table'[ProductName], 'Table'[Price] ),
'Table'[Price]
)```

Try this, just remplace 'Table' with your table name.  This will create the unique list of products and prices, then using averagex, iterate over these to create the average price.

Highlighted
Anonymous
Not applicable

Re: Calculating The Avg Price from Distinct Set of Prices

```CALCULATE
(
AVERAGEX
(
SUMMARIZE
(
'Table'
,'Table'[ProductName]
,'Table'[Price]
)
,'Table'[Price]
)
,FILTER
(
VALUES('Table'[Price])
,NOT(ISBLANK('Table'[Price])) && 'Table'[Price] <> 0
)
)```
4 REPLIES 4
Super User I

Re: Calculating The Avg Price from Distinct Set of Prices

@DataUsurper  any chance you can share the data in text not image?

Proud a to be a Datanaut!
Anonymous
Not applicable

Re: Calculating The Avg Price from Distinct Set of Prices

```Calc :=
AVERAGEX (
SUMMARIZE ( 'Table', 'Table'[ProductName], 'Table'[Price] ),
'Table'[Price]
)```

Try this, just remplace 'Table' with your table name.  This will create the unique list of products and prices, then using averagex, iterate over these to create the average price.

Regular Visitor

Re: Calculating The Avg Price from Distinct Set of Prices

Thank you, that's the format. I was trying it with the Averagex/Summarize swapped. Is there a place where I can only include > 0 records? No blanks or 0s

Highlighted
Anonymous
Not applicable

Re: Calculating The Avg Price from Distinct Set of Prices

```CALCULATE
(
AVERAGEX
(
SUMMARIZE
(
'Table'
,'Table'[ProductName]
,'Table'[Price]
)
,'Table'[Price]
)
,FILTER
(
VALUES('Table'[Price])
,NOT(ISBLANK('Table'[Price])) && 'Table'[Price] <> 0
)
)```

Announcements

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.