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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Sparky156
New Member

Multiple If Statement Referencing Month/Year

Good day,

 

I have a data set I pull from one of our systems looking at funding from the current Fiscal Year and then the previous five Fiscal Years. Each year has hundreds of thousands of accounting lines. I am trying to build a Power Query where I can update the data set and it automatically gives me the lines I need to deobligate based on the criteria I provide in the Power Query.

 

In Column6 there are 14 character long Standard Document Numbers using the first three letters of the last name, the last four of the SSN, six numbers of an order and ending with either a "0", A for October, B for November, and so on, excluding "I".

 

I created a Conditional Column labeled [Month] that gives me the month the obligation posted based on the last character in Column6. "0" simply returns null. I created another Conditional Column labeled [Year] that gives me the year of the funding based on the last two characters in Column10, i.e. "19" = 2019, etc.Month_Year.png

 

I am wanting to create a Custom Column that looks at the month in column [Month] and the year in column [Year] and compares them to the current DateTime.LocalNow value. If the month and year match then I want it to return a 1, else 0. This way I can automaticall exclude the current months obligations and only look at those obligations that are in the past and have disbursements posted against them (this is the criteria I provide in the Power Query).So_Far_So_Good.png

 

I get to this point and the formula breaks. I have tried different variations of Date.Month, Date.IsInCurrentMonth, etc. 

And_It_Broke.png

 

Please let me know if you have any suggestions!

1 ACCEPTED SOLUTION
Syk
Resident Rockstar
Resident Rockstar

I believe it's because your "if" is capitalized.

Syk_0-1721837281178.pngSyk_1-1721837293713.png

 

View solution in original post

2 REPLIES 2
Syk
Resident Rockstar
Resident Rockstar

I believe it's because your "if" is capitalized.

Syk_0-1721837281178.pngSyk_1-1721837293713.png

 

Thank you for the quick reply! I knew Power Query was case sensitive but since I wasn't getting a syntax error I did not perceive that to be the issue. Thank you again!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors