title: How do I write a DAX Query in Power BI that compares text values to determine if a change has occurred?
body: <p>Essentially, we have a list of departments and risk ratings by year. Ideally, for cases where a department has increased in risk between 2021 and 2022, the result would be &quot;Increase,&quot; where risk has stayed the same it would be &quot;No Change,&quot; and where it's decreased it would be &quot;Decrease.&quot; We only care about 2022 being compared to 2021. How would you write this query? Here's a sample with dummy data:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Dep</th>
  <th style="text-align: center;">Year</th>
  <th style="text-align: left;">Risk Rating</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">A</td>
  <td style="text-align: center;">2022</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">A</td>
  <td style="text-align: center;">2021</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">A</td>
  <td style="text-align: center;">2020</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">B</td>
  <td style="text-align: center;">2022</td>
  <td style="text-align: left;">High</td>
  </tr>
  <tr>
  <td style="text-align: left;">B</td>
  <td style="text-align: center;">2021</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">B</td>
  <td style="text-align: center;">2020</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">C</td>
  <td style="text-align: center;">2022</td>
  <td style="text-align: left;">Low</td>
  </tr>
  <tr>
  <td style="text-align: left;">C</td>
  <td style="text-align: center;">2021</td>
  <td style="text-align: left;">High</td>
  </tr>
  <tr>
  <td style="text-align: left;">C</td>
  <td style="text-align: center;">2020</td>
  <td style="text-align: left;">High</td>
  </tr>
  <tr>
  <td style="text-align: left;">D</td>
  <td style="text-align: center;">2022</td>
  <td style="text-align: left;">Medium</td>
  </tr>
  <tr>
  <td style="text-align: left;">D</td>
  <td style="text-align: center;">2021</td>
  <td style="text-align: left;">Medium</td>
  </tr>
  <tr>
  <td style="text-align: left;">D</td>
  <td style="text-align: center;">2020</td>
  <td style="text-align: left;">Medium</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Thanks so much for any help you can provide.</p>