cancel
Showing results for
Did you mean:
New Member

## Simple Calculated Column?

Hi folks,

I've got a basic Date table with a DIMDate[Date] primary key.

I'm trying to create a boolean calculated column that determines if the [Date] is part of a completed school year.  New school years start at the Month of September.  Here's what I've tried with no luck:

School Year Completed =
VAR YearCheck = YEAR(DIMDate[Date]) <= YEAR(Today())
VAR MonthCheck = MONTH(DIMDate[Date]) < 9

VAR Result = YearCheck && MonthCheck

RETURN Result

My table has data from January 1, 2015 through December 31, 2022.  I expect the DAX to return TRUE for all dates up to August 31, 2022, and FALSE thereafter.  But not working.  It is ignoring my YearCheck condition, and returning FALSE in any year so long as month greater than or equal to 9

1 ACCEPTED SOLUTION
Community Champion

aha, try this

School Year Completed =
VAR YearCheck = YEAR(DIMDate[Date])
VAR MonthCheck = MONTH(DIMDate[Date])
VAR Result =
IF (
YEAR(DIMDate[Date]) >= YEAR(Today())
&&MONTH(DIMDate[Date]) >= 9,
FALSE,
TRUE
)
RETURN Result
4 REPLIES 4
Community Champion

try this,

School Year Completed =
VAR YearCheck = YEAR(DIMDate[Date])
VAR MonthCheck = MONTH(DIMDate[Date])
VAR Result =
IF (
YEAR(DIMDate[Date]) <= YEAR(Today())
&&MONTH(DIMDate[Date]) < 9,
TRUE,
FALSE
)
RETURN Result

New Member

Still no luck:

Community Champion

aha, try this

School Year Completed =
VAR YearCheck = YEAR(DIMDate[Date])
VAR MonthCheck = MONTH(DIMDate[Date])
VAR Result =
IF (
YEAR(DIMDate[Date]) >= YEAR(Today())
&&MONTH(DIMDate[Date]) >= 9,
FALSE,
TRUE
)
RETURN Result
New Member

Boom!  The converse logic works!  Thanks much.

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors