Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have a column containing report dates. I want to create another column that reflects a reporting period, so for instance if the date of the report is after 2/5, it returns "Feb YY" and if any report date is after 1/7 it returns "Jan YY." I understand that I would need to have it parse the latest date first, then nest another "if" statement after it for the earlier reporting period.
I have tried
Reporting Period = IF ( [Report Date] > 2/5/YY, "Feb YY", IF ( [Report Date] > 1/5/YY, "Jan "YY", "NA"))
and
Reporting Period = SWITCH(TRUE(), [Report Date] > 2/5/YY, "Feb YY", [Report Date] > 1/5/YY, "Jan YY")
Both scenarios return a column with Feb YY in every row, unless I switch the dates; whichever date comes first is what ends up being evaluated, and its result returned throughout.
Any ideas?
Solved! Go to Solution.
Hi @ripstaur ,
You should use Date function when referencing dates.
Reporting Period v2 =
IF (
[Report Date] > DATE ( 2021, 2, 5 ),
"Feb 21",
IF ( [Report Date] > DATE ( 2021, 1, 5 ), "Jan 21", "NA" )
)
Attached demo file. You can make it more dynamic if needed to always compare to 5th day of month. Idea started, you can customize if needed.
This is the result:
Best regards,
Nemanja Andic
Hi @ripstaur ,
You should use Date function when referencing dates.
Reporting Period v2 =
IF (
[Report Date] > DATE ( 2021, 2, 5 ),
"Feb 21",
IF ( [Report Date] > DATE ( 2021, 1, 5 ), "Jan 21", "NA" )
)
Attached demo file. You can make it more dynamic if needed to always compare to 5th day of month. Idea started, you can customize if needed.
This is the result:
Best regards,
Nemanja Andic
This is exactly what I needed to know! Thank you so much!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
87 | |
84 | |
65 | |
49 |
User | Count |
---|---|
140 | |
114 | |
110 | |
59 | |
59 |