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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Kratos_ZA
Helper I
Helper I

Capping variance at 999%

Greetings good people!

 

Please assist with capping the variance to a 999%. The reason for this is in some instances, the variance of MTD vs PY MTD is many digits eg 14628%. Instead, I would like it to reflect or be capped at 999%.

 

 

How can I amend my DAX below to do this?

 

DAX:

 

spl MTD VAR% Gross Activation =
VAR __BASELINE_VALUE = [spl MTD Gross Activation]
VAR __VALUE_TO_COMPARE = [MTD Gross Activation]
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),    
    IF(ISBLANK(DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)),VALUE("0.00"),DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE))
    )
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Kratos_ZA

 

Please try:

 

spl MTD VAR% Gross Activation =
VAR __BASELINE_VALUE = [spl MTD Gross Activation]
VAR __VALUE_TO_COMPARE = [MTD Gross Activation]
VAR __VALUE =
    IF (
        NOT ISBLANK ( __VALUE_TO_COMPARE ),
        IF (
            ISBLANK ( DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE ) ),
            VALUE ( "0.00" ),
            DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )
        )
    )
VAR __RESULT =
    MIN ( __VALUE, 9.99 )
RETURN
    __RESULT

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

Anonymous
Not applicable

Hi @Kratos_ZA ,

Use SWITCH:

 

spl MTD VAR% Gross Activation =
VAR __BASELINE_VALUE = [spl MTD Gross Activation]
VAR __VALUE_TO_COMPARE = [MTD Gross Activation]
VAR __VALUE =
    IF (
        NOT ISBLANK ( __VALUE_TO_COMPARE ),
        IF (
            ISBLANK ( DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE ) ),
            VALUE ( "0.00" ),
            DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )
        )
    )
VAR __RESULT =
    SWITCH ( TRUE (), __VALUE < -9.99, -9.99, __VALUE > 9.99, 9.99, __VALUE )
RETURN
    __RESULT

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

 

View solution in original post

5 REPLIES 5
Kratos_ZA
Helper I
Helper I

Thanks so much! I really really appreciate the help!

Anonymous
Not applicable

@Kratos_ZA

 

Please try:

 

spl MTD VAR% Gross Activation =
VAR __BASELINE_VALUE = [spl MTD Gross Activation]
VAR __VALUE_TO_COMPARE = [MTD Gross Activation]
VAR __VALUE =
    IF (
        NOT ISBLANK ( __VALUE_TO_COMPARE ),
        IF (
            ISBLANK ( DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE ) ),
            VALUE ( "0.00" ),
            DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )
        )
    )
VAR __RESULT =
    MIN ( __VALUE, 9.99 )
RETURN
    __RESULT

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Thank you so much! One more thing, I forgot to add, the bottom cap sorry. So it must not exceed 999% and not be lower than -999%, how can we add -999% to the dax you just did?

Anonymous
Not applicable

Hi @Kratos_ZA ,

Use SWITCH:

 

spl MTD VAR% Gross Activation =
VAR __BASELINE_VALUE = [spl MTD Gross Activation]
VAR __VALUE_TO_COMPARE = [MTD Gross Activation]
VAR __VALUE =
    IF (
        NOT ISBLANK ( __VALUE_TO_COMPARE ),
        IF (
            ISBLANK ( DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE ) ),
            VALUE ( "0.00" ),
            DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )
        )
    )
VAR __RESULT =
    SWITCH ( TRUE (), __VALUE < -9.99, -9.99, __VALUE > 9.99, 9.99, __VALUE )
RETURN
    __RESULT

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

 

@Anonymous 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors