Forum Discussion

TonyGoose_001's avatar
TonyGoose_001
New Member
2 years ago
Solved

Divide measure that excludes values without Calculate

Hi   I wish to amend the following query to exlcude "No" from the numerator as well as the demoninator. However if I use CALCULATE to try and achieve this it loses the context and sets all values t...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, TonyGoose_001 

    You can try this measure to achieve your need.


    Measure:

    % Responses = 
    VAR _countOfResponses =
        CALCULATE (
            COUNT ( 'Table'[Responses] ),
            FILTER ( 'Table', 'Table'[Responses] <> "BLANK" )
        )
    VAR _allCountsOfResponses =
        CALCULATE ( COUNT ( 'Table'[Responses] ), 'Table'[Responses] <> "BLANK" )
    VAR _result =
        IF (
            NOT ISBLANK ( _countOfResponses ),
            DIVIDE ( _countOfResponses, _allCountsOfResponses )
        )
    RETURN
        _result
    

     

    Best Regards,
    Yang

    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 in the Power BI Forum