cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## 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

Accepted Solutions
Super User

## Re: Slicer-based date range used as parameters for calculated column

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

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

Proud to be a Datanaut!

3 REPLIES 3
Member

## Re: Slicer-based date range used as parameters for calculated column

Hello,

You can try this:

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

Regards,

ElenaN

Super User

## Re: Slicer-based date range used as parameters for calculated column

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

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

Proud to be a Datanaut!

Frequent Visitor

## Re: Slicer-based date range used as parameters for calculated column

Thank you, works perfectly!

Announcements

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 110 members 1,459 guests
Recent signins: