Forum Discussion
Triple date sort in Matrix
How can do triple sort for below based on all date ascending (ignoring Blank) in below order-
1st by Date try 1 (Ascending to descending with Non-blanks on top)
2nd by Date try 2( Ascending to descending with Non-blanks on top)
3rd by Date try 3( Ascending to descending -this will always hve some date populated)-
When I make a sort measure and put that in the matrix, it gives blanks on the top if I do Ascending to Descending.
Input Data
| Date try 3 | Date try 1 | Date try 2 |
| 1/07/2022 | 7/07/2022 | 7/07/2022 |
| 25/06/2022 | 6/07/2022 | 1/07/2022 |
| 25/06/2022 | 1/07/2022 | 30/06/2022 |
| 28/06/2022 | 8/07/2022 | |
| 18/06/2022 | 27/06/2022 | |
| 25/06/2022 | 7/07/2022 | 1/07/2022 |
| 25/06/2022 | 6/07/2022 | 1/07/2022 |
| 1/07/2022 | 6/07/2022 | 7/07/2022 |
| 1/07/2022 | 30/06/2022 | 7/07/2022 |
| 28/06/2022 | 8/07/2022 | |
| 28/06/2022 | 8/07/2022 | |
| 23/06/2022 | 8/07/2022 | 30/06/2022 |
| 28/06/2022 | 8/07/2022 | 14/07/2022 |
| 1/07/2022 | 8/07/2022 | 7/07/2022 |
| 1/07/2022 | 2/07/2022 | 7/07/2022 |
| 30/06/2022 | 6/07/2022 | 13/07/2022 |
| 1/07/2022 | ||
| 3/07/2022 | ||
| 1/07/2022 | ||
| 1/07/2022 | 18/07/2022 | |
| 21/06/2022 | 27/06/2022 | |
| 5/07/2022 | 11/07/2022 | |
| 29/06/2022 | 7/07/2022 | |
| 29/06/2022 | 7/07/2022 | |
| 1/07/2022 | 7/07/2022 | |
| 6/07/2022 | ||
| 6/07/2022 | ||
| 25/07/2022 | ||
| 13/07/2022 | ||
| 13/07/2022 | ||
| 3/08/2022 | ||
| 17/07/2022 | ||
| 17/07/2022 | ||
| 13/07/2022 | ||
| 12/07/2022 | ||
| 12/07/2022 | ||
| 12/07/2022 |
Outpur requied
| Date try 3 | Date try 1 | Date try 2 |
| 1/07/2022 | 30/06/2022 | 7/07/2022 |
| 25/06/2022 | 1/07/2022 | 30/06/2022 |
| 1/07/2022 | 2/07/2022 | 7/07/2022 |
| 25/06/2022 | 6/07/2022 | 1/07/2022 |
| 25/06/2022 | 6/07/2022 | 1/07/2022 |
| 1/07/2022 | 6/07/2022 | 7/07/2022 |
| 30/06/2022 | 6/07/2022 | 13/07/2022 |
| 25/06/2022 | 7/07/2022 | 1/07/2022 |
| 1/07/2022 | 7/07/2022 | 7/07/2022 |
| 23/06/2022 | 8/07/2022 | 30/06/2022 |
| 1/07/2022 | 8/07/2022 | 7/07/2022 |
| 28/06/2022 | 8/07/2022 | 14/07/2022 |
| 18/06/2022 | 27/06/2022 | |
| 21/06/2022 | 27/06/2022 | |
| 29/06/2022 | 7/07/2022 | |
| 29/06/2022 | 7/07/2022 | |
| 1/07/2022 | 7/07/2022 | |
| 28/06/2022 | 8/07/2022 | |
| 28/06/2022 | 8/07/2022 | |
| 28/06/2022 | 8/07/2022 | |
| 5/07/2022 | 11/07/2022 | |
| 1/07/2022 | 18/07/2022 | |
| 1/07/2022 | ||
| 1/07/2022 | ||
| 3/07/2022 | ||
| 3/07/2022 | ||
| 6/07/2022 | ||
| 6/07/2022 | ||
| 8/07/2022 | ||
| 12/07/2022 |
learner03 , refer to the video on a similar topic
Hi,
I am not sure if I understood your data model correctly.
I assume you have a kind of index column that differenciates a row that has the same information with other row.
Please check the below picture and the attached pbix file.
I created a sort column inside the table, and showed it toghether in a table visualization.
Sort by condition CC = IF ( Data[Date try 1] = BLANK (), 0, RANKX ( FILTER ( Data, Data[Date try 1] <> BLANK () ), INT ( Data[Date try 1] ), , DESC ) ) * 1000000 + Data[Index] + IF ( Data[Date try 2] = BLANK (), 0, RANKX ( FILTER ( Data, Data[Date try 2] <> BLANK () ), INT ( Data[Date try 2] ), , DESC ) ) * 10000 + Data[Index] + RANKX ( FILTER ( Data, Data[Date try 3] <> BLANK () ), INT ( Data[Date try 3] ), , DESC ) * 100 + Data[Index]
3 Replies
- amitchandakSuper User
learner03 , refer to the video on a similar topic
- learner03Post Partisan
amitchandak this gives me Non-Blanks at the top but do not sort by Earliest date in matrix
- Jihwan_KimSuper User
Hi,
I am not sure if I understood your data model correctly.
I assume you have a kind of index column that differenciates a row that has the same information with other row.
Please check the below picture and the attached pbix file.
I created a sort column inside the table, and showed it toghether in a table visualization.
Sort by condition CC = IF ( Data[Date try 1] = BLANK (), 0, RANKX ( FILTER ( Data, Data[Date try 1] <> BLANK () ), INT ( Data[Date try 1] ), , DESC ) ) * 1000000 + Data[Index] + IF ( Data[Date try 2] = BLANK (), 0, RANKX ( FILTER ( Data, Data[Date try 2] <> BLANK () ), INT ( Data[Date try 2] ), , DESC ) ) * 10000 + Data[Index] + RANKX ( FILTER ( Data, Data[Date try 3] <> BLANK () ), INT ( Data[Date try 3] ), , DESC ) * 100 + Data[Index]