Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Group data in intervals

Hello  I have a column containing the depth of several nodes, which I would like to group in intervals in a report. Is this possible or do I need to do some DAX calculation first?    Basically as ...
  • amitchandak's avatar
    5 years ago

    Anonymous , Create a new column like

    Switch(true(),
    [Depth] <=1 , " 0-1",
    [Depth] <=2, " 1-2",
    [Depth] <=3 , "2-3"
    )

     

    and then take sum "number of" or count of "number of" in the visual with this new column

  • Anonymous's avatar
    Anonymous
    5 years ago

    amitchandak 

     

    Perfect, if I have empty values it is currently added to the interval 0-1, how do I make it so the blank/empty cells are also empty/blank in the new Interval Column? 

     

    Edit: 

    Figured out the Blank handling. 

     

    DybdeInterval = Switch(true();
    Knude[Dybde] = Blank(); Blank();
    Knude[Dybde] <1 ; "0-1";
    Knude[Dybde] <2; "1-2";
    Knude[Dybde] ❤️ ; "2-3")
     
    How do I make sure it doesn't count negative values? Right now Negative values are counted in 0-1 group, can you have two different conditions in a group?
     
    Edit 2:
    Think I figured out how to handle negative values, let me know if my syntax is wrong. 
     
    DybdeInterval = Switch(true();
    Knude[Dybde] = Blank(); Blank();
    Knude[Dybde] >0 && Knude[Dybde] < 1; "0-1";
    Knude[Dybde] >0 && Knude[Dybde] <2; "1-2";
    Knude[Dybde] >0 && Knude[Dybde] < 3 ; "2-3";
    Knude[Dybde] >0 && Knude[Dybde] <4 ; "3-4")