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
Hakim34400
New Member

Find the next order type filtered by PoDExternal number and date using a ranking Dax calc

Hakim34400_0-1668020015435.png

Hi everyone,

 

My issue is summarize in the screenshot above.

The calc works great for dates (sequential) however for text (order type), it will put text in but sometimes it will be the wrong text. Almost like it is pulling based upon alphabetical order rather than by order date.

 

Any help would be highly appreciated,

Thank you so much,

Kim

1 ACCEPTED SOLUTION

Hi @Hakim34400 ,

 

The date and the num can be sort directly because they are considered numbers can be directly compared in size.

The text is indeed sorted by default in alphabetical order, so you can sort it by sort the date in the visual.

In the data table, you can get the result but can not sort them, but you can add them in the table visual and sort the result as you want.

Looks like this, I create a table based on your code:

vyinliwmsft_0-1668071404350.png

 

Then I use your code to get the result:

vyinliwmsft_1-1668071404356.png

 

And in the visual, you can select which column do you want.

vyinliwmsft_2-1668071404361.png

 

 

Hope this helps you.

And here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Hakim34400
New Member

NEXT MAT = 
CALCULATE(
   MIN('1_New Attachments 1'[Order Number.Order Number Level 01.Maintenance Activity (Key)]),
    FILTER(
        ALLEXCEPT(
            '1_New Attachments 1',
            '1_New Attachments 1'[PoD(External).PoD(External) Level 01]
        ),
        '1_New Attachments 1'[FCMP Date.FCMP Date Level 01]
        >EARLIEST('1_New Attachments 1'[FCMP Date.FCMP Date Level 01])&&'1_New Attachments 1'[Rank Date]>EARLIER('1_New Attachments 1'[Rank Date])-1
        )
    )

Sorry forgot to add the code. Thanks again.

Hi @Hakim34400 ,

 

The date and the num can be sort directly because they are considered numbers can be directly compared in size.

The text is indeed sorted by default in alphabetical order, so you can sort it by sort the date in the visual.

In the data table, you can get the result but can not sort them, but you can add them in the table visual and sort the result as you want.

Looks like this, I create a table based on your code:

vyinliwmsft_0-1668071404350.png

 

Then I use your code to get the result:

vyinliwmsft_1-1668071404356.png

 

And in the visual, you can select which column do you want.

vyinliwmsft_2-1668071404361.png

 

 

Hope this helps you.

And here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors