Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi, I am trying to create a custom column in PowerBI via power query but I can't seem to get the correct formula. I need to determine if a date is </> 6 months & then have the new column populated with "Current" or "OAI" based on the true/false value.
So...
If {Column w/ Date} >6 months from today then "OAI"
If {Column w/ Date} <6 months from today then "Current"
Thanks in advance for your help!
Solved! Go to Solution.
Hi @BrookeO3 ,
You can get the inventory status by adding a custom column in Power Query Editor or DAX, please find the details in the attachment.
1. Create a custom column in Power Query Editor just as suggested by @Anonymous
Here it need to make some change in his formula as below, the part with red font is updated one:
| =if [Last fulfillment date] > Date.AddMonths(Date.From(DateTime.LocalNow()), - 6) then "Current" else "OAI" |
Add custom column in Power Query Editor
2. Create a calculated column as below by DAX
Column =
IF (
DATEDIFF ( 'Table'[Last fulfillment date], TODAY (), MONTH ) > 6,
"OAI",
"Current"
)
Best Regards
Hi @BrookeO3 ,
You can get the inventory status by adding a custom column in Power Query Editor or DAX, please find the details in the attachment.
1. Create a custom column in Power Query Editor just as suggested by @Anonymous
Here it need to make some change in his formula as below, the part with red font is updated one:
| =if [Last fulfillment date] > Date.AddMonths(Date.From(DateTime.LocalNow()), - 6) then "Current" else "OAI" |
Add custom column in Power Query Editor
2. Create a calculated column as below by DAX
Column =
IF (
DATEDIFF ( 'Table'[Last fulfillment date], TODAY (), MONTH ) > 6,
"OAI",
"Current"
)
Best Regards
Hi again. I think the formula is correct, but I am getting an error in my new column.
Hi @BrookeO3
Please use the below code
= Table.AddColumn(#"Changed Type6", "FinancialYear", each if [DateCaseCreated] < Date.AddMonths(getdate(), -6) then "Current" else "OAI" )
Hi, thanks for your response. I am getting an error in the "getdate" part of the formula - I can't figure out what I am missing.
@BrookeO3 replace getdate with Date.From(DateTime.LocalNow())
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 65 | |
| 62 | |
| 31 | |
| 26 | |
| 25 |