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
Anonymous
Not applicable

Comparing Dates Measure

Hello,

 

I am looking to make a conditional measure that compares two date fields. The first compares if the date is less than Todays date AND if there is a blank date in the other column. I can have the return be either a numeric count or categorical. There are multiple lines for each order so would like to find the max date that meets this criteria for each order. 

Currently using: Past = CALCULATE(COUNT('TABLE'[OrderNum]),FILTER('Table','Table'[First Date] < TODAY() && ISBLANK(Table[Second Date])))

But this is returning no output. 

 

Therefore the output would be something like this: 

 

Order

First DateSecond DateOutput
11/1/20221/3/20220 or "Good"
25/1/20224/1/2022 0 or "Good"
36/7/2022 1 or "Past"
11/1/2022 1 or "Past"

Additionally I have the challenge of erronious dates in the first date column that I would like to filter out.

 

Thanks so much for the help!

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

I have created a simple smaple, please refer to it to see if it helps you.

Create a measure.

Measure = IF(MAX('Table'[First Date])<=TODAY()&&MAX('Table'[Second Date])=BLANK(),1,0)

 

Or I have modified the measure. Please refer to.

Currently using: Past = CALCULATE(COUNT('Table'[order]),FILTER(ALL('Table'),'Table'[First Date]<=TODAY()&&'Table'[Second Date]=BLANK()))

vpollymsft_0-1669944726406.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

I have created a simple smaple, please refer to it to see if it helps you.

Create a measure.

Measure = IF(MAX('Table'[First Date])<=TODAY()&&MAX('Table'[Second Date])=BLANK(),1,0)

 

Or I have modified the measure. Please refer to.

Currently using: Past = CALCULATE(COUNT('Table'[order]),FILTER(ALL('Table'),'Table'[First Date]<=TODAY()&&'Table'[Second Date]=BLANK()))

vpollymsft_0-1669944726406.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

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.

Top Solution Authors