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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ashmitp869
Post Partisan
Post Partisan

Date field - sorting ascending issues due to null ?

Hi,

My date field is not sorting ascending as I got null.

ashmitp869_0-1746062685711.png



Expected result - 

ashmitp869_1-1746062707395.png

 

1 ACCEPTED SOLUTION
govind_021
Super User
Super User

Hi @ashmitp869 

To handle the sorting in your table visual and ensure blank rows appear last while sorting dates in ascending order, 
You can create a calculated column in your table that assigns a numeric value based on whether the date is blank or not. Here's an example DAX formula:

Step 1 - Create a sorting column using dates
SortOrder = IF(ISBLANK(Table[Date]), 1, 0)

This creates a column sort order where

  • Blank dates get a value of 1
  • Non-blank dates get a value of 0

    Step 2 - configure sorting in power bi
  1. Go to the Fields pane and select your Date column.
  2. Set the sort by column as the newly created Sort Order.
  3. In your table visual, include the Date field as usual. The blank rows will appear last, and the non-blank rows will sort in ascending order.

    Best Regards
    Govind Sapkade ( Microsoft Certified Data Analyst , PL 300 Certified , MS Fabric Enthusiast)
    Let's Connect
    Linkdin - www.linkedin.com/in/govind-sapkade-845104225
    Youtube - http://www.youtube.com/@govind_dataanalyst

View solution in original post

1 REPLY 1
govind_021
Super User
Super User

Hi @ashmitp869 

To handle the sorting in your table visual and ensure blank rows appear last while sorting dates in ascending order, 
You can create a calculated column in your table that assigns a numeric value based on whether the date is blank or not. Here's an example DAX formula:

Step 1 - Create a sorting column using dates
SortOrder = IF(ISBLANK(Table[Date]), 1, 0)

This creates a column sort order where

  • Blank dates get a value of 1
  • Non-blank dates get a value of 0

    Step 2 - configure sorting in power bi
  1. Go to the Fields pane and select your Date column.
  2. Set the sort by column as the newly created Sort Order.
  3. In your table visual, include the Date field as usual. The blank rows will appear last, and the non-blank rows will sort in ascending order.

    Best Regards
    Govind Sapkade ( Microsoft Certified Data Analyst , PL 300 Certified , MS Fabric Enthusiast)
    Let's Connect
    Linkdin - www.linkedin.com/in/govind-sapkade-845104225
    Youtube - http://www.youtube.com/@govind_dataanalyst

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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