How do I correct the error of converting type Text to type True/False in Power Bi?

Carin Mansfield 61 Reputation points
2021-08-19T10:31:18.787+00:00

I am trying to execute the below query but I keep getting the error: Cannot convert value '2017Q2' of type Text to type True/False.

In this query I want to figure out a full year based on the four quarters (ie."2017Q1","2017Q2","2017Q3","2017Q4").

To explain what the code should do
If the [Closed Quarter] = 2017Q1"or"2017Q2"or"2017Q3"or"2017Q4" then display ,"2017 FULL YEAR"
else
If the [Closed Quarter] = 2018Q1"or"2018Q2"or"2018Q3"or"2018Q4" then display , "2018 FULL YEAR"
else
If the [Closed Quarter] = 2019Q1"or"2019Q2"or"2019Q3"or"2019Q4" then display ,"2019 FULL YEAR"
else
If the [Closed Quarter] = 2020Q1"or"2020Q2"or"2020Q3"or"2020Q4" then display ,"2020 FULL YEAR"
else
If the [Closed Quarter] = 2021Q1"or"2021Q2"or"2021Q3"or"2021Q4" then display ,"2021 FULL YEAR"
else display "UNKNOWN"

How do I correct the error of converting type Text to type True/False?

Please see below Power Bi code

Full Year = SWITCH(
TRUE(),
OR('Case Data'[Closed Quarter] = "2017Q1"||"2017Q2","2017Q3"||"2017Q4"),"2017 FULL YEAR",
OR('Case Data'[Closed Quarter] = "2018Q1"||"2018Q2","2018Q3"||"2018Q4"), "2018 FULL YEAR",
OR('Case Data'[Closed Quarter] = "2019Q1"||"2019Q2","2019Q3"||"2019Q4"), "2019 FULL YEAR", OR('Case Data'[Closed Quarter] = "2020Q1"||"2020Q2","2020Q3"||"2020Q4"), "2020 FULL YEAR", OR('Case Data'[Closed Quarter] = "2021Q1"||"2021Q2","2021Q3"||"2021Q4"), "2021 FULL YEAR", "UNKNOWN")

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,575 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Laude 85,686 Reputation points
    2021-08-19T11:03:25.567+00:00

    Hi @Carin Mansfield ,

    Please note that Power BI is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products.

    You may ask the experts in the dedicated Power BI forum over here:
    https://community.powerbi.com/t5/Forums/ct-p/PBI_Comm_Forums

    ----------

    If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!

    Best regards,
    Leon

    0 comments No comments

0 additional answers

Sort by: Most helpful