cancel
Showing results for
Did you mean:
Highlighted
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.

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 Contributor

## 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

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

#### Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

#### Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

#### Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)