Forum Discussion
Earlier function on the fly
- 5 years ago
Hi Anonymous ,
You need to create the following measures, be aware that I'm divinding this in several measure so you can have the calculations checked.
Amount = SUM(PCC_Analysis2[Amount]) Rank_Values = RANKX(ALLSELECTED(PCC_Analysis2[Customer]); CALCULATE([Amount]) + + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000) Cumulative Total based on Rank = CALCULATE([Amount]; TOPN([Rank_Values];ALLSELECTED(PCC_Analysis2[Customer]);[Amount] + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000 ) ) % of Products Running Total = DIVIDE([Cumulative Total based on Rank];CALCULATE([Amount];ALLSELECTED(PCC_Analysis2[Customer])))The idea here is to pick up the TOPN lines that are equal to the ranking.
Adding the + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000 allows to make the equal values to be different.
Be aware that I'm making a relationship between slicer and fact table.
Anonymous Using you PBIX file thanks in advance
Check PBIX file attach.
Hi Anonymous,
I'm sorry, I guess I'm having trouble explaining myself.
I couldn't understand why did you create a ID column for customers. By the way it is not a dynamic calculation how can I apply this method to all my dataset.
I don't want to sort my customers by their customer ID. My requirement is so simple.
Earlier function is okey for me but it is working on column I need to work with measure.
The amount% measure is working fine which you created.
In this case we just need cumulative sum for amount% when we sort amount% from big to small.
Your result is sorting by customer.
Expected Result Examples
I really need help for this case. I couldn't find any solution. Thank you for your endless helps.
Hi Anonymous ,
You need to create the following measures, be aware that I'm divinding this in several measure so you can have the calculations checked.
Amount = SUM(PCC_Analysis2[Amount])
Rank_Values = RANKX(ALLSELECTED(PCC_Analysis2[Customer]); CALCULATE([Amount]) + + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000)
Cumulative Total based on Rank =
CALCULATE([Amount];
TOPN([Rank_Values];ALLSELECTED(PCC_Analysis2[Customer]);[Amount] + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000 )
)
% of Products Running Total =
DIVIDE([Cumulative Total based on Rank];CALCULATE([Amount];ALLSELECTED(PCC_Analysis2[Customer])))
The idea here is to pick up the TOPN lines that are equal to the ranking.
Adding the + INT ( CALCULATE ( MIN ( PCC_Analysis2[Customer]) ) ) / 100000 allows to make the equal values to be different.
Be aware that I'm making a relationship between slicer and fact table.
Anonymous Using you PBIX file thanks in advance
Check PBIX file attach.