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

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

Reply
8047444
Frequent Visitor

IF statement to return if currentdate is between 2 dates from fields to get true/false

Hello, I'm looking for some advice - My goal is to be able to show or hide a message on my dashboard for report users regarding data during payroll processing and hide when this message is not valid.

I'm trying to create a measure that will give me a 1(True) if Today() (currentdate) is between a start and end date.  Currently I have 2 fields - Payroll Processing Start and Payroll Processing End.  

Example:
Today (3/2/23)
(From my table which 1 row for each pay period and columns for pay dates, processing start, processing end..etc.)
Payroll_Processing_Start 2/26/2023      Payroll_Processing_End 3/1/2023
I would expect my measure to return 0 (False)

I tried an IF statement:

IF(Payroll_Calendar[PAYROLL_PROCESSING_START] <= TODAY() && Payroll_Calendar[CURRENTPAYROLLSTART] >= TODAY() 
but I'm getting an error too many rows to evaluate....
So I thought I could create a measure for the start and end dates but that's not working either (or I'm doing it wrong).



1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@8047444 Try:

Measure =
  VAR __End = MAX(Payroll_Calendar[PAYROLL_PROCESSING_START])
  VAR __Start = MAX(Payroll_Calendar[CURRENTPAYROLLSTART])
  VAR __Today = TODAY()
  VAR __Result = IF( __Today >= __Start && __Today <= __End, 1, 0)
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
8047444
Frequent Visitor

@Greg_Deckler - thank you that works!

Greg_Deckler
Community Champion
Community Champion

@8047444 Try:

Measure =
  VAR __End = MAX(Payroll_Calendar[PAYROLL_PROCESSING_START])
  VAR __Start = MAX(Payroll_Calendar[CURRENTPAYROLLSTART])
  VAR __Today = TODAY()
  VAR __Result = IF( __Today >= __Start && __Today <= __End, 1, 0)
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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 Solution Authors
Users online (4,557)