Forum Discussion
Pareto with duplicate values
Hi greggbb ,
Try the following formula:
Order =
VAR RoundedSales = [Score Measure]
RETURN IF (
HASONEVALUE ( JoinMatrix[Business Risk] ) && ( RoundedSales > 0 ),
VAR CustomersWithRankedName =
ADDCOLUMNS (
ALLSELECTED ( JoinMatrix ),
"@NameRanked", RANKX ( ALLSELECTED ( JoinMatrix ), JoinMatrix[Business Risk],, DESC, DENSE )
)
VAR MaxCustomerNameRanked =
MAXX ( CustomersWithRankedName, [@NameRanked] )
VAR LookupTable =
ADDCOLUMNS (
CustomersWithRankedName,
"@CustomerSales",
[Score Measure] * MaxCustomerNameRanked + [@NameRanked]
)
VAR CurrentName =
SELECTEDVALUE ( JoinMatrix[Business Risk] )
VAR CurrentNameRanked =
RANKX ( ALLSELECTED ( JoinMatrix ), JoinMatrix[Business Risk], CurrentName, DESC, DENSE )
VAR CurrentValue = RoundedSales * MaxCustomerNameRanked + CurrentNameRanked
VAR Ranking =
RANKX ( LookupTable, [@CustomerSales], CurrentValue,, DENSE )
RETURN
Ranking
)Business Risk Cumulative =
var thisProduct = [Score Measure]
var allProducts = calculate( [Score Measure], all(JoinMatrix[Business Risk] ) )
var maxCurrentRank = [Order]
var rankTable = FILTER( ALLSELECTED(JoinMatrix[Business Risk]), [Order] <= maxCurrentRank)
return CALCULATE([Score Measure], rankTable) / allProducts
Referencing: https://www.sqlbi.com/articles/rankx-on-multiple-columns-with-dax-and-power-bi/
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Winniz, but that isn't working either. In fact it's all coming in at 98%:
This has become oddly complicated for something that I can easily build in Excel. I'm going to look for a different visualization to get my point across as it doesn't seem Power BI can handle the math when duplication is involved.
Thanks,
Gregg
- v-kkf-msft5 years agoCommunity Support
Hi greggbb ,
Could you please share your PBIX file without sensitive data? In my test data, it works well.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- protopic242 years agoNew Member