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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! 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
Super User
Super User

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

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
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.