Forum Discussion

DianaChris's avatar
DianaChris
Frequent Visitor
3 years ago

Categorising a column

Hi All,

 

I have a Score column(whole number) and based on the scores I need to create a new column and categorise them as Very Low, Low, Medium, High, Very High. Can someone help me with the logic to achieve this in DAX.

Note: The score value changes periodically.

11 Replies

  • Hello DianaChris !

     

    You can create a DAX Column and use something like this:

     

    Column =
    SWITCH(TRUE(),
    Score> *Value1*, "Label1",

    Score > *Value2*, "Label2",
    "")

    • DianaChris's avatar
      DianaChris
      Frequent Visitor

      Hello JorgePinho,

       

      Thanks for your solution. But, the score column will be changing periodically. So, I can't mention a static value in the code. The code should dynamically handle the changing score values. Is there a way?

      • JorgePinho's avatar
        JorgePinho
        Solution Sage

        Hello, DianaChris. The score is dynamic in my solution since it references the column values. If the column values change the new column will be calculated again.

        The only thing that is static in my solution is the tresholds (Value1 and Value2) to define the category. You want to turn those dynamic as well?

    • DianaChris's avatar
      DianaChris
      Frequent Visitor

      Hi AbbasG 

       

      Thanks for your solution. But, as mentioned, the score column will be changing periodically. So the range of score varies every period. 

      • AbbasG's avatar
        AbbasG
        Memorable Member

        DianaChris if you can share sample data or pbix file with more information, may be I can help better.