Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello,
Checking to see if I can create a condtional column that applies to a certain date. For instance I need a column to only apply to 2021 but not 2020.
So I would create a column that says If x = y than 1 otherwise 0. I need this to apply only to 2021 data but not for 2020. Could i create something that leaves 2020 Null?
Solved! Go to Solution.
New Column CC =
IF (
'Table'[Year] = 2021,
SWITCH ( TRUE (), 'Table'[x] = 'Table'[y], 1, 0 ),
BLANK ()
)
New Column CC =
IF (
'Table'[Year] = 2021,
SWITCH ( TRUE (), 'Table'[x] = 'Table'[y], 1, 0 ),
BLANK ()
)
You could do a custom column with a function like this
= if [Year] = 2021 then 1 else null
or, if it's a Date column
= if Date.Year([Date]) = 2021 then 1 else null
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 35 | |
| 24 | |
| 22 |
| User | Count |
|---|---|
| 135 | |
| 111 | |
| 57 | |
| 44 | |
| 38 |