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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Switch to negative based on Multiple conditions (complex)

My data has a  calculated field for  Return of Investment = (MTD op income/Days in month)*365/MTD Net Investment)

My DAX = CALCULATE ( MAX (CoName ) = "RETURN ON INVESTMENT",
            DIVIDE (
                DIVIDE (
                    CALCULATE (
                        SUM ( Tbname'[ThismonthAmount] ),
                        FILTER (
                            ALLSELECTED ( Tname),
                            'Cname = "OPERATING INCOME"
                        )
                    ),
                    dayscount,
                    0
                ) * 365,
                CALCULATE (
                    SUM ( Tbname'[ThismonthAmount]  ),
                    FILTER (
                        ALLSELECTED ( Tbname),
                        'colname = "NET INVESTMENT"
                    )
                ),
                0

 

My issue is the Net Investment at times is negative and so is operating income.  I need to add condional stament to check (

Both operating income and net investment are negative. ROI % should be negative.

 when negative Net Investment & Positive Operating Income ROI % should show as 9999.99). I have created variable for both operating income and net investment . Can someone please help me with the DAX  that first check the above condition and based on that applies a negative sign or inserts 9999.99 

 

TIA

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @VahidDM 

I  tried  both options and the issue is at times i get 9999.00  and the  first condition gives 0 or vice versa am I incorrectly applying it TIA

 

CALCULATE ( MAX ( 'consolidate AggSOPAccountLevel'[SOPLineDesc] )
) = "RETURN ON INVESTMENT", SWITCH(TRUE(), [Operating INCOME] < 0
&& [Net Investment] < 0, ROI*-1, [Operating INCOME] > 0 && [Net Investment] < 0, "9999.99",0),
//IF (
// [Operating INCOME] < 0
// && [Net Investment] < 0,
//ROI *-1,
// IF ( [Operating INCOME] > 0 && [Net Investment] < 0, "9999.99", ABS ( roi ) )
// ),

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @Anonymous 

 

You need to create measue like this by using those variables:

 

Final ROI % = if([Net Investment]<0&&[Operating Income]<0,ABS(ROI %)*-1,if([Net Investment]<0&&[Operating Income]>0, 9999.99,ROI %))

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_0-1630039343275.png!!

Anonymous
Not applicable

Thanks @VahidDM 

I  tried  both options and the issue is at times i get 9999.00  and the  first condition gives 0 or vice versa am I incorrectly applying it TIA

 

CALCULATE ( MAX ( 'consolidate AggSOPAccountLevel'[SOPLineDesc] )
) = "RETURN ON INVESTMENT", SWITCH(TRUE(), [Operating INCOME] < 0
&& [Net Investment] < 0, ROI*-1, [Operating INCOME] > 0 && [Net Investment] < 0, "9999.99",0),
//IF (
// [Operating INCOME] < 0
// && [Net Investment] < 0,
//ROI *-1,
// IF ( [Operating INCOME] > 0 && [Net Investment] < 0, "9999.99", ABS ( roi ) )
// ),

Hi @Anonymous ,

 

Could you please share sample data or PBIX file without sensitive data?

 

Best Regards,
Winniz

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.