cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Regular Visitor

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

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
Super User

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

Regular Visitor

Still no luck:

Super User

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
Regular Visitor

Boom!  The converse logic works!  Thanks much.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors