Forum Discussion

tyan's avatar
tyan
Helper II
4 years ago
Solved

Pie Chart and switch function

Hi thank you for helping me. I new to BI and try to create some easy graphic to see the whole picture.    So I would like to create a pie chart that show how many stores that their rating are less ...
  • VahidDM's avatar
    4 years ago

    HI tyan 

     

    Use this code to add a new calculated column to your table:

    Cat. = 
    SWITCH (
        TRUE (),
        [Rating] < 0.2, "<20%",
        [Rating] > 0.2
            && [Rating] <= 0.25, "20%~25%",
        [Rating] > 0.25
            && [Rating] <= 0.5, "25%~50%",
        [Rating] > 0.5
            && [Rating] <= 0.75, "50%~75%",
        [Rating] > 0.75
            && [Rating] <= 1, "75%~100%"
    )

     

    Then use that to create a pie chart:

     

     

     

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/