Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Red for negative and green for positive

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?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

 

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.

vpollymsft_0-1662517160612.png

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.

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

 

 

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.

vpollymsft_0-1662517160612.png

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.

 

 

Anonymous
Not applicable

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?

Anonymous
Not applicable

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.

Anonymous
Not applicable

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:

Color = SWITCH(MAX('Sort Table'[line description]),
"Net Profit"
,
IF (
    MAX ( 'Sort Table'[Iine description] ) = "Net Profit"
        && [Net profit] < 0,
    "#BA3030",
    IF (
        MAX ( 'Sort Table'[line description] ) = "Net Profit"
            && [Net profit] >= 0,
        "#58AD42",
        BLANK ()
    )
),
"Total Expenses,"#BA3030",
"Revenue","#58AD42"
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.