Forum Discussion
Showing an average for % when using TopN
Hi all,
I've been having some trouble getting my average % to show correctly when using TopN. I've created measures that display the correct results based on what's selected in the TopN slicer, and my totals are summing correctly which is great, but I have a YOY% field that's not averaging based on the TopN. It's rather showing the average of all styles, instead of TopN.
As an example, for this field, I'd expect to see 54%, instead of 16%:
I've searched the posts on here, posts on other sites, but can't find anyone who is trying to display an average based on TopN.
Here's what I'm working with:
Has anyone run across this issue? If anyone has a more simple way to do this, I'd love to hear it. I basically need to display Net Sales & Units on a style-level, and LY & YOY for each when TopN is selected. The YOY is what's giving me trouble.
Many thanks.
user5341567
Instead of directly averaging theUnits YOY - Styles, try recalculating YOY% based on the aggregated totals of Units and Units LY:Corrected_YOY_Styles =
VAR Total_Units = SUMX(FILTER(dim_class_desc, [ShowStyleSales]), [Units])
VAR Total_Units_LY = SUMX(FILTER(dim_class_desc, [ShowStyleSales]), [Units LY])RETURN
IF(Total_Units_LY > 0, (Total_Units / Total_Units_LY) - 1)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
2 Replies
- johnbasha33Super User
user5341567
Instead of directly averaging theUnits YOY - Styles, try recalculating YOY% based on the aggregated totals of Units and Units LY:Corrected_YOY_Styles =
VAR Total_Units = SUMX(FILTER(dim_class_desc, [ShowStyleSales]), [Units])
VAR Total_Units_LY = SUMX(FILTER(dim_class_desc, [ShowStyleSales]), [Units LY])RETURN
IF(Total_Units_LY > 0, (Total_Units / Total_Units_LY) - 1)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!- user5341567Helper I
Excellent, this worked perfectly. Thank you for your response!