Forum Discussion

Rockies_Skier's avatar
Rockies_Skier
Regular Visitor
4 years ago
Solved

Custom Column if statements returning inconsistent results

I am attempting to create a custom column classifying count values into ranges of specified interest via the following:

 

 

if [count] = null then "< 2" else 

if [count] < 2 then "< 2" else 

if [count] >= 2 and [count] <= 3 then "2 - 3" else 

if [count] = 4 then "4" else 

if [count] >= 5 then "5 +" else ""

 

 

However, the results being returned are inconsistent at times. The vast majority of values are correctly assigned to the required ranges, but at times I am noticing counts of various amounts getting classified incorrectly such as 12 and 8 falling into "4" or a count of 8 falling into "2-3". 

 

I'm fairly new to PowerBI and am uncertain on the approach to take from here. 

  • can you provide a picture of the data rows that get classified wrongly please?

     

2 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    can you provide a picture of the data rows that get classified wrongly please?

     

    • Rockies_Skier's avatar
      Rockies_Skier
      Regular Visitor

      Thanks for the quick response, I found the real error I am seeing. The classifications from the query were indeed correct, but in a visual I am currently using the field is getting summarized incorrectly in the tooltips. Marked your response as the solution and pursuing the error I am seeing otherwise.