Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jack555
Advocate I
Advocate I

"Sort by" based on condition

Would like to sort the count column based on the date column. desired sorting as in Sort 1 or Sort 2. I tried sorting by date and adding index. however since it runs above million records, not a best way to do it.

 

Montha and date column combination sort is the ideal, however i can live with date only sorting index without affecting the performance. Please advice how to do this? either in DAX or power query.  I need this to sort a visual since "count" column values affecting the sort funciton.

 

I am a beginner, please guide accordingly. 

 

IDTypeItemDateCountSort 1Sort 2
1MonthBall01/01/20225528
2MonthBat01/01/20227239
3MonthGlove01/01/20223012
4MonthBall23/02/202215411
5MonthHat27/04/202280515
6QuarterBall01/01/20223314
7QuarterBat01/01/20224036
8QuarterStick01/01/20222121
9QuarterBoot23/02/202270412
10QuarterHat27/04/202259514
11YearBoot01/01/20223113
12YearBat01/01/20224837
13YearGlove01/01/20223725
14YearBag23/02/202210410
15YearHat27/04/202215513
2 REPLIES 2
jgeddes
Super User
Super User

You can try the following calculated column

Rank =
var _type =
'Table (6)'[Type]
Return
RANKX(
    FILTER(
        ALL('Table (6)'),
        'Table (6)'[Type] = _type
    ),
    [Date]&[Count],,
    ASC
)
 
Replace 'Table (6)' with your table name.



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks. I tried, below error.

jack555_0-1665469607566.png

column names are little different.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.