Forum Discussion
Line Chart sort x-axis by y-axis
- 6 years ago
Hi Anonymous ,
How about add a Rank column in your table, like so:
Rank column = RANKX ( 'Table', CALCULATE ( DISTINCTCOUNT ( 'Table'[MFG] ) + SUM ( 'Table'[ID] ) / 10000, ALLEXCEPT ( 'Table', 'Table'[Seller] ) ), , DESC, DENSE )Then, create the bar visual with "Rank column".
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
How about add a Rank column in your table, like so:
Rank column =
RANKX (
'Table',
CALCULATE (
DISTINCTCOUNT ( 'Table'[MFG] )
+ SUM ( 'Table'[ID] ) / 10000,
ALLEXCEPT ( 'Table', 'Table'[Seller] )
),
,
DESC,
DENSE
)
Then, create the bar visual with "Rank column".
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Icey
What is the reasoning behind
SUM ( 'Table'[ID] ) / 10000And why is the sum divided by 10000?
It does not work for me.
Using this code:
Rank column =
RANKX (
'BaseData';
CALCULATE (
DISTINCTCOUNT ( 'BaseData'[MFG] )
+ SUM ( BaseData[Index] ) / 10000;
ALLEXCEPT ( 'BaseData'; 'BaseData'[Seller] )
);
;
DESC;
DENSE
)- Icey6 years agoCommunity Support
Hi Anonymous ,
For your question, it is used to re-sort the same sorted sellers. For example, Seller 1 and Seller 2 rank the same, both are the 3th. In order not to "sum" the two values on the visual, seller 2 is ranked 3th and seller 1 is ranked 4th.
Then, please let me know if the "Index" column in your table is the ID of "Seller"? If not, please correct it.
It is best to give me some sample data (not real data) and keep it consistent with your real data structure.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Hi Icey
My index column was not correct. However, correcting it, resulted in the same.
I have created a small dataset with 475 sellers you can use. It can be found here: https://drive.google.com/file/d/1aBXWKbupO4crg0DRa68G4v83YMraSi4-/view?usp=sharing
- Icey6 years agoCommunity Support
Hi Anonymous ,
I have tested with the sample data you provided, and it works well. So weird.
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.