Forum Discussion

animebuff's avatar
animebuff
Helper I
1 year ago
Solved

DAX issue

requirement:   left side visual is what by default we get in PBI what I need is right side visual but the values of all region should not be 0.31 rather apac - 1 europe - 0.5 la - 0.5 af...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi wini_R 

     

    Please try this measure:

    MEASURE =
    VAR _currentRegion =
        SELECTEDVALUE ( 's rate'[region] )
    VAR _ifdenominator =
        COUNTROWS (
            SUMMARIZE (
                FILTER (
                    ALLSELECTED ( 's rate' ),
                    's rate'[region] = _currentRegion
                        && 's rate'[inclusion flag] = "n"
                ),
                's rate'[mk],
                's rate'[region]
            )
        )
    VAR _outcome =
        CALCULATE ( COUNT ( 'S rate'[success] ), 'S rate'[inclusion flag] = "Y" )
            / COUNT ( 'S rate'[success] )
    RETURN
        IF ( _outcome <> BLANK (), _outcome, IF ( _ifdenominator <> 1, 1, 0 ) )
    

    The result is as follow:

     

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.