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.
Hi there.
I have a table (Dates) that looks like this.
Month | Year |
Jan 2017 | 2017 |
Feb 2017 | 2017 |
May 2018 | 2018 |
September 2019 | 2019 |
February 2020 | 2020 (pre covid) |
March 2020 | 2020 (post covid) |
June 2020 | 2020 (post covid) |
Jan 2021 | 2021 |
I am looking to create a column (in red) to explore the impact pre and post covid so that it will just give me the year for 2018, 2019 and 2021 but for 2020 it splits it into two i.e. Jan 2020 and Feb 2020 = 2020 (pre covid) and March 2020 onwards = 2020 (post covid)
Could anyone help with this as this is quite complex?
Solved! Go to Solution.
@Anonymous
do you have a date column? if you have a date column, you can try this
year = if(year('Date'[Date])=2020 && month('Date'[Date]) in {1,2},"2020 pre covid",if(year('Date'[Date])=2020,"2020 post covid",FORMAT('Date'[Date],"yyyy")))
Proud to be a Super User!
@Anonymous
do you have a date column? if you have a date column, you can try this
year = if(year('Date'[Date])=2020 && month('Date'[Date]) in {1,2},"2020 pre covid",if(year('Date'[Date])=2020,"2020 post covid",FORMAT('Date'[Date],"yyyy")))
Proud to be a Super User!
@Anonymous Create next calculated columns:
'Year' - original year;
'Month' - month's number (january - 1, february - 2 etc.)
'customYear': SWITCH(TRUE(),
'Year'=2020&&'Month'<=2,"2020 (pre covid)",
'Year'=2020&&'Month'>2,"2020 (post covid)",
'Year')
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 |