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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Date Validation

All good folks! My problem is the following, I looked for everything here and I didn't find something similar. I need to create a custom column that returns me a result if the current date is within the date range and another result if it isn't. For example:

 

Today=12/21/2012

 

Start date   End date   Result

12/20/2021   12/24/2021   1

12/17/2021   12/20/2021   0

12/21/2021   12/22/2021   1

12/23/2021   12/24/2021   1

 

Note: If the date range is in the future, that is, it is greater than the current day for example, the result must also be 1, as the date range is still valid.

 

Well I hope I managed to explain. Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

= each if [Date] > #date(2021, 12, 20) and [Date] < #date(2021, 12, 24) then 1 else if [Date] < #date(another date) and < #date(another date) then 1 else if [Date] > #date(another date) then 0

 

--Nate

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

thanks man i tried it and i got it with this

let
DataAtual = DateTime.Date(DateTime.LocalNow())
in
if [Data Início da Visita] <= DataAtual and
[Data Fim da Visita] >= DataAtual then "Válida"
else "Expirada"

 

 

Anonymous
Not applicable

= each if [Date] > #date(2021, 12, 20) and [Date] < #date(2021, 12, 24) then 1 else if [Date] < #date(another date) and < #date(another date) then 1 else if [Date] > #date(another date) then 0

 

--Nate

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors