Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculated column using SWITCH fucntion

Hi Experts , I am new to Power BI . My requirement is I need to populate  calculated column as Group from the existing column Item  for example  Item                       Group Shirt            ...
  • JarroVGIT's avatar
    6 years ago

    Hi Anonymous ,

    You may add a calculated column to your table with the following DAX:

    Group = 
    SWITCH(TRUE(),
        'Table'[Item] = "Shirt", "Cloth",
        'Table'[Item] = "Pants", "Cloth",
        'Table'[Item] = "Laptop", "Electronic Device",
        'Table'[Item] = "Mobile", "Electronic Device",
        "Other")

    Is this what you are looking for?

     

    Kind regards

    Djerro123

    -------------------------------

    If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

    Keep those thumbs up coming! 🙂