Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Measure a field between two values MIN and MAX

Hi ! I'm trying to measure a field between two values ...for example, I have a record with a counter that has the value 7 and I have a group (the groups are not in dynamics365) "bucketB"(which has ...
  • v-lionel-msft's avatar
    6 years ago

    Hi Anonymous ,

    My original table:

    //Column
    Bucket = 
    SWITCH(
        TRUE(),
        [Score] = 0 , "0",
        [Score] >= 1 && [Score] <= 30, "1-30",
        [Score] >= 31 && [Score] <= 45, "31-45",
        [Score] >= 46 && [Score] <= 60, "46-60",
        [Score] > 60, "61+"
    )
    
    Min_ = 
    SWITCH(
        TRUE(),
        [Score] = 0 , 0,
        [Score] >= 1 && [Score] <= 30, 1,
        [Score] >= 31 && [Score] <= 45, 31,
        [Score] >= 46 && [Score] <= 60, 46,
        [Score] > 60, 61
    ) 
    
    Max_ = 
    SWITCH(
        TRUE(),
        [Score] = 0 , 0,
        [Score] >= 1 && [Score] <= 30, 30,
        [Score] >= 31 && [Score] <= 45, 45,
        [Score] >= 46 && [Score] <= 60, 60,
        [Score] > 60, 150
    )
    
    Sort Order = 
    RANKX(
        Sheet6,
        [Min_],
        ,
        ASC,
        Dense
    )
    
    //Measure
    number = 
    CALCULATE(
        COUNT(Sheet6[Score]),
        ALLEXCEPT(
            Sheet6,
            Sheet6[Bucket]
        )
    )

     

     

    Best regards,
    Lionel Chen

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.