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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
andrewb95
Helper II
Helper II

DateDiff with blanks

I have a table with data similar to below:

 

IDDate ADate BDate Diff
102.06.2021  
2 09.07.2021 
301.01.202105.01.20214
407.02.202101.02.2021-6

 

As you can see there are four possible outcomes... 

1. Date A happens first and there is no Date B for this row

2. Date B happens first and there is no Date A for this row 

3. Date A happens first but the action has been taken in Date B too 

4. Date B happens first but the action has been taken in Date A too 

 

I want to be able to make a table which shows the count for each four items 1-4. So I can identify which is the most popular flow. 

Then also for 1 and 2 I will be able to manipulate the date diff. 

 

Please advise?

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@andrewb95 

is this what you want?

1 = countx(FILTER('Table',ISBLANK('Table'[Date B])),'Table'[Date A])

2 = countx(FILTER('Table',ISBLANK('Table'[Date A])),'Table'[Date B])

3 = countx(FILTER('Table','Table'[Date A]<'Table'[Date B]),'Table'[Date A])

4 = countx(FILTER('Table','Table'[Date A]>'Table'[Date B]&&NOT(ISBLANK('Table'[Date B]))),'Table'[Date A])




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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @andrewb95 ,

 

According to your description, I did a test and think that the solution provided by @ryan_mayu  can meet your needs. If there is still confusion, please point out and provide the desired result, I will answer you as soon as possible.

vhenrykmstf_1-1628564495996.png

 

 

 Looking forward to your reply.


Best Regards,
Henry


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

ryan_mayu
Super User
Super User

@andrewb95 

is this what you want?

1 = countx(FILTER('Table',ISBLANK('Table'[Date B])),'Table'[Date A])

2 = countx(FILTER('Table',ISBLANK('Table'[Date A])),'Table'[Date B])

3 = countx(FILTER('Table','Table'[Date A]<'Table'[Date B]),'Table'[Date A])

4 = countx(FILTER('Table','Table'[Date A]>'Table'[Date B]&&NOT(ISBLANK('Table'[Date B]))),'Table'[Date A])




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

Proud to be a Super User!




amitchandak
Super User
Super User

@andrewb95 , expected output is not clear, what value should be there in first 2 rows

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.