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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mkeisha
Helper I
Helper I

Slicer-based date range used as parameters for calculated column

My calendar table starts on 9/1/2017 and ends on 4/30/2019.  I am simply trying create a calculated column that indicates if the date is either in the BASE period or in the TEST period.  The BASE period runs from 9/1/2017 to 6/30/2018 and the TEST period runs from 7/1/2018 to 4/30/2019.  What is wrong with my calculated column because it returns TEST PERIOD for all the dates including those which are part of the base period?

 

=if(('Calendar'[Date] >= 9/1/2017 && 'Calendar'[Date] <= 6/30/2018), "Base Period", "Test Period")

 

Thank you.  

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @mkeisha,

Try the following formula:
Colum =
IF (
(
'Calendar'[Date] >= DATE ( 2017, 9, 1 )
&& 'Calendar'[Date] <= DATE ( 2018, 6, 30 )
),
"Base Period",
"Test Period"
)

Regards,
MFelix

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @mkeisha,

Try the following formula:
Colum =
IF (
(
'Calendar'[Date] >= DATE ( 2017, 9, 1 )
&& 'Calendar'[Date] <= DATE ( 2018, 6, 30 )
),
"Base Period",
"Test Period"
)

Regards,
MFelix

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you, works perfectly!

ElenaN
Resolver V
Resolver V

Hello,

 

You can try this:

=if(('Calendar'[Date] >= DATEVALUE("9/1/2017") && 'Calendar'[Date] <= DATEVALUE("6/30/2018")), "Base Period", "Test Period")

Regards,

ElenaN

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.