Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have table with two columns with dates Release date and closed date.
I want to create custom column, but I don't know how i should create formula.
Basically I need 3 category
1) if relase date is before 1.1.2020 then "1)
2) if release date is after 31/12/2019 and before 1/1/2020 then "2"
3) if closed date is before 1/1/2021 then "3"
How formula should look like?
Solved! Go to Solution.
Hi @Anonymous ,
You can add custom column with the formula as shown in below screenshot, later please adjust the conditions base on your scenario..
=if [Release date] < #date(2020, 1, 1) then 1
else if [Release date] > #date(2019, 12, 31) and [Release date] < #date(2021, 1, 1) then 2
else if [closed date] < #date(2021, 1, 1) then 3
else 0
Best Regards
Hi @Anonymous ,
You can add custom column with the formula as shown in below screenshot, later please adjust the conditions base on your scenario..
=if [Release date] < #date(2020, 1, 1) then 1
else if [Release date] > #date(2019, 12, 31) and [Release date] < #date(2021, 1, 1) then 2
else if [closed date] < #date(2021, 1, 1) then 3
else 0
Best Regards
You can use this formula in a custom column in the query editor
= if [release date] < #date(2020,1,1) then "1" else if ([release date] > #date(2019,12,31) and [release date] < #date(2020,1,1)) then "2" else if [closed date] < #date(2021,1,1) then "3" else "other"
Note your #2 condition seems off, so you can adjust as needed.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I wrote this and I have "Error" in each cell instead of "1", "2" etc. :c
I encountered the same issue. Check if the Data Type of your date columns ([release date], [closed date]) is in "Date". The above doesn't seem to work on "Date/Time" data. I tried it on "Date" data and it worked.
Hi @Anonymous ,
Create a custom column in Power Query level and write this code..
Custom Column = if [Release date] < #date(2020, 01, 01) then "1" else if [Release date] > #date( 2019, 12, 31) and [Release date] < #date( 2020, 01, 01) then "2" else if [closed date] < #date (2021, 01, 01) then "3" else "0"
Hi, I wrote this code and I have errors in each cell.
I encountered the same issue. Check if the Data Type of your date columns ([release date], [closed date]) is in "Date". The above doesn't seem to work on "Date/Time" data. I tried it on "Date" data and it worked.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
204 | |
86 | |
64 | |
59 | |
56 |