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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

time difference

Hello.

 

I have 2 columns with the following data: picking date and faturation date. I want to know the time difference between these two processes but in some rows I dont have the picking date and in some rows I dont have the faturation date. So, I only want the time difference between orders that have the 2 fields and if I dont have at least one field in one column, I want a message like "without dates". 

 

Anyone can help?

2 ACCEPTED SOLUTIONS
Sujit_Thakur
Solution Sage
Solution Sage

Dear @Anonymous 

You can use this measure 

This will work the best and also you will be able to filter by field using any drop down or slicer

Date Diff = CALCULATE(IF(ISBLANK(SUMX(Sheet1,Sheet1[Picking Date ])) || ISBLANK(SUMX(Sheet1,Sheet1[faturation Date])),"no dATE" ,SUMX(Sheet1,DATEDIFF(Sheet1[Picking Date ] , Sheet1[faturation Date],DAY))))
 

 

This will do the job 

Just use your table name in the place where i have used Sheet1

 

 

I would appreciate a kudos and if this helped please accept as solution so our other brothers and sisters can get help from it 👍

 

 

If any more further doubt please let me know .

Regards 

Thakur Sujit 

View solution in original post

Hi @Anonymous ,

 

Try creating a Calculated Column

 

New Column =
IF (
    'Table'[picking date]
        <> BLANK ()
        && 'Table'[faturation date]
            <> BLANK (),
    DATEDIFF (
        'Table'[picking date],
        'Table'[faturation date],
        DAY
    ),
    99999
)

 

If any of the dates are not present it will return 99999. YOu cannot have text and number values in the same column.

 

Regards,

Harsh Nathani

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Dear @Anonymous ,
You can please atleast appreciate the solution authors by giving kudos  .
Both of above post are also correct solution , you can accept both of them as solution if you want.
Regards ,

thakur sujit

Sujit_Thakur
Solution Sage
Solution Sage

Dear @Anonymous 

You can use this measure 

This will work the best and also you will be able to filter by field using any drop down or slicer

Date Diff = CALCULATE(IF(ISBLANK(SUMX(Sheet1,Sheet1[Picking Date ])) || ISBLANK(SUMX(Sheet1,Sheet1[faturation Date])),"no dATE" ,SUMX(Sheet1,DATEDIFF(Sheet1[Picking Date ] , Sheet1[faturation Date],DAY))))
 

 

This will do the job 

Just use your table name in the place where i have used Sheet1

 

 

I would appreciate a kudos and if this helped please accept as solution so our other brothers and sisters can get help from it 👍

 

 

If any more further doubt please let me know .

Regards 

Thakur Sujit 

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Try creating a Calculated Column

 

 

 

 

New Column =
IF (
    'Table'[picking date]
        <> BLANK ()
        && 'Table'[faturation date]
            <> BLANK (),
    DATEDIFF (
        'Table'[picking date],
        'Table'[faturation date],
        DAY
    ),
    99999
)

 

 

 

 

If any of the dates are not present it will return 99999. YOu cannot have text and number values in the same column.

 

Incase you need time difference in hour, second, minutes, weeks  replace DAY by them. Refer the below guide

 

https://dax.guide/datediff/

 

Regards,

Harsh Nathani

 

Hi @Anonymous ,

 

Try creating a Calculated Column

 

New Column =
IF (
    'Table'[picking date]
        <> BLANK ()
        && 'Table'[faturation date]
            <> BLANK (),
    DATEDIFF (
        'Table'[picking date],
        'Table'[faturation date],
        DAY
    ),
    99999
)

 

If any of the dates are not present it will return 99999. YOu cannot have text and number values in the same column.

 

Regards,

Harsh Nathani

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.