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.
Hello,
I’ve gotten stuck at a few places trying to conditionally format my data, and hopefully this makes sense. I'm tring to build a script in order to make each cell be given a 0,1,or a 2 in a seprate column. And I am using these values (0-2) to refer back to a color table to be able to conditioanlly format by a each row. The problems I have run into is that there are percentages and integers in each column of my data, with the percentages, some are considered good when they’re higher and others are the opposite so the conditions are different for each of the different metrics. I want to be able to slice my data based on BU and by metric.
So then I decided on building a script to go through each order(which is each metric) and then based on which Business Unit it was for, try and conditionally format it like that. So make it either 0,1,2 for the color scheme. Hopefully the picture with my code will make sense, but I’m not getting any output when I run the code…
PLS Help
AllCompany(JAN) =
IF('Sheet1'[Order]==1,
IF([Division]=="-All of company",
IF('Sheet1'[Jan]>=95,2,
IF('Sheet1'[Jan]<95 && 'Sheet1'[Jan]>71,1,
IF('Sheet1'[Jan]<=71,0,
IF([Division]=="Bank",
IF('Sheet1'[Jan]>=23,2,
IF('Sheet1'[Jan]<23 && 'Sheet1'[Jan]>17,1,
IF('Sheet1'[Jan]<=17,0,
Also, this is just part of my code, i know i need a third argument for the IF funtion. I tried it with a sample third argument and did not get any output in the colomn.
@Anonymous wrote:Hello,
I’ve gotten stuck at a few places trying to conditionally format my data, and hopefully this makes sense. I'm tring to build a script in order to make each cell be given a 0,1,or a 2 in a seprate column. And I am using these values (0-2) to refer back to a color table to be able to conditioanlly format by a each row. The problems I have run into is that there are percentages and integers in each column of my data, with the percentages, some are considered good when they’re higher and others are the opposite so the conditions are different for each of the different metrics. I want to be able to slice my data based on BU and by metric.
So then I decided on building a script to go through each order(which is each metric) and then based on which Business Unit it was for, try and conditionally format it like that. So make it either 0,1,2 for the color scheme. Hopefully the picture with my code will make sense, but I’m not getting any output when I run the code…
PLS Help
AllCompany(JAN) =
IF('Sheet1'[Order]==1,
IF([Division]=="-All of company",
IF('Sheet1'[Jan]>=95,2,
IF('Sheet1'[Jan]<95 && 'Sheet1'[Jan]>71,1,
IF('Sheet1'[Jan]<=71,0,
IF([Division]=="Bank",
IF('Sheet1'[Jan]>=23,2,
IF('Sheet1'[Jan]<23 && 'Sheet1'[Jan]>17,1,
IF('Sheet1'[Jan]<=17,0,
Hi y2jz,
I think the if condition should be measure=if(<condition>=xxx, true condition, false condition). I saw you use "==" in measure or column, will this prompt error information?
In addition, if possible, could you please inform me more detailed information(such as your data sample and your expected output)? Then I will help you more correctly.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I guess I would need an ELIF function like in python that would read as if a condition is not met fot the first IF function than it will move onto the next. @dax
This still did not work for me :
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 |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |