Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table with a one measure formula:
Financial Value =
SWITCH(
SELECTEDVALUE('Sort Table'[line description]),
"Minutes Expenses",[ Minute expenses],
"Total Expenses",[ total Expenses]
"Business Expenses",[ Business Expenses],
"Payroll Expenses",[ Payroll Expenses],
"Revenue",[ Total revenue],
"Taxes",[ Total revenue]*taxes]),
"Net Profit" , [Net profit]))
I want to apply a formula to the net profit to give me a condition for if number is negative then show me a red number and if number is positive then show me green color is there a way?
Solved! Go to Solution.
Hi @Anonymous ,
I have modified the measure.
Financial Value =
SWITCH (
SELECTEDVALUE ( 'Sort Table'[line description] ),
"Minutes Expenses", [ Minute expenses],
"Total Expenses", [ total Expenses],
"Business Expenses", [ Business Expenses],
"Payroll Expenses", [ Payroll Expenses],
"Revenue", [ Total revenue],
"Taxes", [ Total revenue] * [taxes],
"Net Profit", [Net profit]
)
Then create a measure based on the [Financial Value] measure.
Measure =
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] < 0,
"Red",
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] >= 0,
"Green",
BLANK ()
)
)
Then use the condition format like the following.
If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output with more details.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I have modified the measure.
Financial Value =
SWITCH (
SELECTEDVALUE ( 'Sort Table'[line description] ),
"Minutes Expenses", [ Minute expenses],
"Total Expenses", [ total Expenses],
"Business Expenses", [ Business Expenses],
"Payroll Expenses", [ Payroll Expenses],
"Revenue", [ Total revenue],
"Taxes", [ Total revenue] * [taxes],
"Net Profit", [Net profit]
)
Then create a measure based on the [Financial Value] measure.
Measure =
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] < 0,
"Red",
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] >= 0,
"Green",
BLANK ()
)
)
Then use the condition format like the following.
If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output with more details.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
yesss it works thank you very much but can you help me add also for revenue and total expenses? like if ="revenue" then green and if = "total expenses" then red. can i add it to the measure you provided me?
Hi @Anonymous ,
Of course. Please refer to the formula.
Measure =
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] < 0,
"Red",
IF (
MAX ( 'Sort Table'[line description] ) = "Net Profit"
&& [Net profit] >= 0,
"Green",
IF (
MAX ( 'Sort Table'[line description] ) = "revenue",
"Green",
IF (
MAX ( 'Sort Table'[line description] ) = "total expenses",
"Red",
BLANK ()
)
)
)
)
If I have misunderstood your meaning, please your desired output with more details.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much but i found another way i used your if measure first for the net profit formula and for the revenue and total expense i used the switch formula:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |