Forum Discussion
Trouble Calculating a Dynamic Average
Hi All,
I am trying to add a new measure that dynamically calculates the average of all the values based on the parameter selection and I am getting an error saying "parameter is not the correct type". I would like this new column to spit out the 17 that is highlighted in the screenshot below.
Any help is greatly appreciated.
thank you!
- Anonymous1 year ago
Hi Anonymous ,
Create this measure.
Average Score = CALCULATE ([Score], ALLSELECTED('OST'))Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
15 Replies
- Dangar332Resident Rockstar
Hi, Anonymous
You had used a measure as Average argument where it's only accept Column refrence not Measure, try to put score column that shown in screenshot .Best Regards,
DangarIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- FreemanZSuper User
hi Anonymous ,
try like:
average =
AVERAGEX(
VALUES(data[sub category]),
[KO Profitability Score]
)
- AnonymousNot applicable
Hi there,
Thanks so much for getting back to me. So when I update per your suggestion above I just get the same values, not the '17' value I was expecting. The first column is based on a parameter and changes between category and sub-category.
Average KO Profitability Score = averagex (VALUES('Field Select Parameter'[Selection Parameter Fields]),[KO Profitability Score])- Dangar332Resident Rockstar
Hi, Anonymous
Try below amended measureAverage KO Profitability Score = averagex ( allselected( 'Field Select Parameter'[Selection Parameter Fields]), [KO Profitability Score] )Best Regards,
DangarIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous ,
Thanks to Dangar332 and FreemanZ for their quick replies. I have some other thoughts to add:
Based on your description, the Score you are displaying on the visual object is the measure, correct? If I have misunderstood you please clarify in a follow up reply.
Then we can create a new measure.Avg = CALCULATE([Score],ALLSELECTED('Table'))Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi All,
Thanks so much for your continuous help here.
The one challenge here is that the "sub-category" field comes from a parameter, which I believe may require some differences in the formula.
You'll see when I create the formula per your suggestion:
Average Score =CALCULATE ([Score], ALLSELECTED('Field Select Parameter'))I get the same figures as my existing column.- FreemanZSuper User
hi Anonymous ,
could you depict your expected result with a table?
- AnonymousNot applicable
Hi Anonymous ,
It works fine through my tests. Can you provide sample pbix files (taking care to protect private data) for us to test?
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Neeko,
Please find a sample file here.
Please let me know if you have any troubles with access.
Thanks!
Maggie
- AnonymousNot applicable
Hi Anonymous ,
Create this measure.
Average Score = CALCULATE ([Score], ALLSELECTED('OST'))Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.