Wednesday, June 24, 2020

Power bi calculated column multiple if statements example

We have a requirement to display the percentage distribution in Power BI. The percentage can be any value from 0% to 100%. However, the report should show the percentage range like 10-20, 20-30, etc.

In order to do this, a calculated column with multiple if statements will be required. If you know the syntax, it will be quite simple. Here is the example.


Percentage Range =
IF([No Action Taken %]=0.00,"0",
 IF(AND([No Action Taken %]>0.00, [No Action Taken %]<=0.10),"1-10",
  IF(AND([No Action Taken %]>0.10, [No Action Taken %]<=0.20),"11-20",
    IF(AND([No Action Taken %]>0.20, [No Action Taken %]<=0.30),"21-30",
      IF(AND([No Action Taken %]>0.30, [No Action Taken %]<=0.40),"31-40",
        IF(AND([No Action Taken %]>0.40, [No Action Taken %]<=0.50),"41-50",
          IF(AND([No Action Taken %]>0.50, [No Action Taken %]<=0.60),"51-60",
            IF(AND([No Action Taken %]>0.60, [No Action Taken %]<=0.70),"61-70",
     IF(AND([No Action Taken %]>0.70, [No Action Taken %]<=0.80),"71-80",
   IF(AND([No Action Taken %]>0.80, [No Action Taken %]<=0.90),"81-90",
IF(AND([No Action Taken %]>0.90, [No Action Taken %]<1),"91-99", "100"
 
)))))))))))

There is another option to use switch you could also try.





No comments:

Post a Comment