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