Forum Discussion
Calculating average price using distict count??
- 8 years ago
Hi hidenseek9,
Try these formulas
Count=DISTINCTCOUNT(Data[Store])
Contribution (%)=[Count]/CALCULATE([Count],ALL(Data[Brand]),ALL(Data[Product]))
Hope this helps.
Hi hidenseek9,
>>I would like to calculate an average price of each product for each brand by store.
For this requirement, you can direct use matrix with original column to achieve this.
Sample:
Brand, Product Name as 'Rows', Stored as 'Columns', Total as Values with summary mode average.
>>Also is there a visual to show an average price as well as the lowest and highest price of the average??
You need to write a calculated column to calculate grouped average value, then create a matrix visual with above category and new calculated column.
AVERAGE =
VAR temp =
SUMMARIZE (
ALL ( 'Sample Data' ),
[Brand],
[Product Name],
[Customer Danone Sales Team Name],
"Average", AVERAGE ( [Price] )
)
RETURN
SELECTCOLUMNS (
FILTER (
temp,
[Brand] = EARLIER ( 'Sample Data'[Brand] )
&& [Product Name] = EARLIER ( 'Sample Data'[Product Name] )
&& [Customer Danone Sales Team Name]
= EARLIER ( [Customer Danone Sales Team Name] )
),
"AVG", [Average]
)
Result visual: category to rows, average to values with summary mode maximum and minimum
Summary.
Expand.
Regards,
Xiaoxin Sheng
- hidenseek98 years agoPost Patron
Anonymous
Thank you for your reply.
I am having a trouble with the DAX formula you provided on AVERAGE.
when I type VAR as a DAX function, below four comes up.
VAR.P
VAR.S
VARX.P
VARX.S
which one do I use to run the DAX formula you provided?
And what would the new formula look like?
Many thanks,
H
- hidenseek98 years agoPost Patron
Anonymous
I am having a trouble with your solution.
Which VAR DAX should I select?
Or any other way to solve the issue?
Many thanks,
H