Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello
Im trying to figure out how to get a colum to if else.
I have a colum for completetion date of course and one with the number of years until retraining and I am trying to calculate the expiry date based on
If completion date = null then "course has not started" else Date.AddYears([Completion Date],[Sheet1.Retraining])
I can currently just add the retraining colum to the completetion date and this gives me a result of the rows that have a completion date. But then I have error for all the ones that have Null instead.
Anyone have any suggestions to achieve this.
Solved! Go to Solution.
Please check the error message. I reckon it is because of the Data type mismatch between the 2 results.
1. "course has not started" is text data type
2. Date.AddYears([Completion Date],[Sheet1.Retraining]) will have date datatype.
My suggestion is:
1. Create a new column "Actual Completion Date Text" with expression: Date.AddYears([Completion Date],[Sheet1.Retraining]).
2. Convert this to Text data type.
3. Add conditional column "Completion Date"
If If completion date = null then (text value) "course has not started" else (column) "Actual Completion Date Text".
This will ensure you have same data type for both if else ouptut.
Worked perfectly, Thank you 🙂
Please check the error message. I reckon it is because of the Data type mismatch between the 2 results.
1. "course has not started" is text data type
2. Date.AddYears([Completion Date],[Sheet1.Retraining]) will have date datatype.
My suggestion is:
1. Create a new column "Actual Completion Date Text" with expression: Date.AddYears([Completion Date],[Sheet1.Retraining]).
2. Convert this to Text data type.
3. Add conditional column "Completion Date"
If If completion date = null then (text value) "course has not started" else (column) "Actual Completion Date Text".
This will ensure you have same data type for both if else ouptut.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |