Forum Discussion
Set a value based on column text
- Anonymous2 years ago
Hi KossithAz ,
Thanks techlog for the quick reply. I have some other thoughts to add:
Based on the error message, it appears that you are creating a metric. If you need to create a measure, use the following formula.
Measure = SWITCH(TRUE(), MAX('Table'[Year])="2021/22",118, MAX('Table'[Year])="2022/23",118, MAX('Table'[Year])="2023/24",110, MAX('Table'[Year])="2024/25",110, BLANK())If you need to create a calculated column, use the following formula.
Column = SWITCH(TRUE(), [Year]="2021/22",118, [Year]="2022/23",118, [Year]="2023/24",110, [Year]="2024/25",110, BLANK())If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi KossithAz ,
Thanks techlog for the quick reply. I have some other thoughts to add:
Based on the error message, it appears that you are creating a metric. If you need to create a measure, use the following formula.
Measure = SWITCH(TRUE(),
MAX('Table'[Year])="2021/22",118,
MAX('Table'[Year])="2022/23",118,
MAX('Table'[Year])="2023/24",110,
MAX('Table'[Year])="2024/25",110,
BLANK())
If you need to create a calculated column, use the following formula.
Column = SWITCH(TRUE(),
[Year]="2021/22",118,
[Year]="2022/23",118,
[Year]="2023/24",110,
[Year]="2024/25",110,
BLANK())
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much, that has worked, and thank you to everyone else 🙂