Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm running into a problem when running my nested IF statement.
If([value.FollowersonTwitter]<=500, "Less than 500",
IF([value.FollowersonTwitter]>=1000, "1000",
IF([value.FollowersonTwitter]>=5000, "5000+",
IF([value.FollowersonTwitter]>=10000, "10,000+", "No Followers"))))
Though when I run it I'm not getting any results for the rows that have 5000 or 10000 followers. What am I missing here?
Thanks!
Solved! Go to Solution.
Hey @LyonsBI_BRL ,
when you have 6000 followers the criteria >=1000 gives back a true and the other options are not checked.
You can either change the order, so that the biggest numbers are checked first:
IF([value.FollowersonTwitter]>=10000, "10,000+",
IF([value.FollowersonTwitter]>=5000, "5000+",
IF([value.FollowersonTwitter]>=1000, "1000",
If([value.FollowersonTwitter]<=500, "Less than 500", "No Followers"))))
Or you have to add a second citeria:
If([value.FollowersonTwitter]<=500, "Less than 500",
IF([value.FollowersonTwitter]>=1000 && [value.FollowersonTwitter]<5000, "1000",
IF([value.FollowersonTwitter]>=5000 && [value.FollowersonTwitter]<10000, "5000+",
IF([value.FollowersonTwitter]>=10000, "10,000+", "No Followers"))))
Also I would recommend to check out the usage of SWITCH(TRUE) as it's a lot clearer than nested ifs:
https://powerpivotpro.com/2015/03/the-diabolical-genius-of-switch-true/
myCalculatedColumn =
SWITCH(
TRUE(),
[value.FollowersonTwitter] >= 10000, "10,000+",
[value.FollowersonTwitter] >= 5000, "5000+",
[value.FollowersonTwitter] >= 1000, "1000",
[value.FollowersonTwitter] <= 500, "Less than 500",
"No Followers"
)
Hey @LyonsBI_BRL ,
when you have 6000 followers the criteria >=1000 gives back a true and the other options are not checked.
You can either change the order, so that the biggest numbers are checked first:
IF([value.FollowersonTwitter]>=10000, "10,000+",
IF([value.FollowersonTwitter]>=5000, "5000+",
IF([value.FollowersonTwitter]>=1000, "1000",
If([value.FollowersonTwitter]<=500, "Less than 500", "No Followers"))))
Or you have to add a second citeria:
If([value.FollowersonTwitter]<=500, "Less than 500",
IF([value.FollowersonTwitter]>=1000 && [value.FollowersonTwitter]<5000, "1000",
IF([value.FollowersonTwitter]>=5000 && [value.FollowersonTwitter]<10000, "5000+",
IF([value.FollowersonTwitter]>=10000, "10,000+", "No Followers"))))
Also I would recommend to check out the usage of SWITCH(TRUE) as it's a lot clearer than nested ifs:
https://powerpivotpro.com/2015/03/the-diabolical-genius-of-switch-true/
myCalculatedColumn =
SWITCH(
TRUE(),
[value.FollowersonTwitter] >= 10000, "10,000+",
[value.FollowersonTwitter] >= 5000, "5000+",
[value.FollowersonTwitter] >= 1000, "1000",
[value.FollowersonTwitter] <= 500, "Less than 500",
"No Followers"
)
Worked perfectly! Like I said I knew I was missing something here!
Thank you again! 😀
@LyonsBI_BRL I'm happy it worked. Yes, that are usually the annoying parts, when you don't see it and search at the wrong spot.
Best regards
Denis
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |