Forum Discussion
Weighted Average Total Measure
- 7 years ago
Hi Anonymous
You may refer to below measure:
Total of DailyWeightedAvg = SUMX ( SUMMARIZE ( ForumData, ForumData[AsOfDate], "a1", [#DailyWeightedAvg] ), [a1] )#DailyWeightedTotal = IF ( HASONEFILTER ( ForumData[HoldingID] ), CALCULATE ( [Total of DailyWeightedAvg], ALL ( ForumData[HoldingID] ) ) )Regards,
Cherie
Hi Anonymous
It seems you need to use HASONEFILTER Function to create a measure like : IF(HASONEFILTER(Table[HoldingID]),[Total of DailyWeightedAvg]). If you need further help, you can upload the sample pbix file to OneDrive or Dropbox and post the link here.
Regards,
Cherie
- Anonymous7 years agoNot applicable
Hi Cherie,
Here is a link to the sample file: https://www.dropbox.com/s/dbfumaz7jkau5dw/ForumSample.pbix?dl=0
I tried using the COUNTROWS method used in the other forum posts. But I'm not sure how to create a [Total of DailyWeightedAvg] measure. In order to create that measure correctly you need the individual row context (to compute weighted values), but then you need to exlclude the row context to get the total, which is why I tried creating a virtual table using SUMMARIZE. However I can't figure out how to incorporate a column from the virtual table into my result.
Thanks for your help
- v-cherch-msft7 years agoMicrosoft Employee
Hi Anonymous
You may refer to below measure:
Total of DailyWeightedAvg = SUMX ( SUMMARIZE ( ForumData, ForumData[AsOfDate], "a1", [#DailyWeightedAvg] ), [a1] )#DailyWeightedTotal = IF ( HASONEFILTER ( ForumData[HoldingID] ), CALCULATE ( [Total of DailyWeightedAvg], ALL ( ForumData[HoldingID] ) ) )Regards,
Cherie
- Anonymous7 years agoNot applicable
Cherie thank you so much! The calculations are working as expected.