Forum Discussion

Tonio_EG's avatar
Tonio_EG
Regular Visitor
3 years ago
Solved

Filter on calculated measure not working

I have the following measure, which is working as expected:

% Market Share = [Sales Amt]/Calculate([Sales Amt],ALL(Data[SellerName]))

 

I then want to calculate this measure, which is puzzlingly returning 100% (100% is definitely not correct):

% Online Market Share = Calculate([% Market Share],FILTER(Data,[ON/OFFLINE] = "Online")

 

Why is this filter not working?

4 Replies

  • Hi,

    Please try something like below whether it suits your requirement.

     

     

    % Online Market Share =
    CALCULATE ( [Sales Amt], FILTER ( Data, [ON/OFFLINE] = "Online" ) )
        / CALCULATE (
            [Sales Amt],
            ALL ( Data[SellerName] ),
            FILTER ( Data, [ON/OFFLINE] = "Online" )
        )
    

     

    • Tonio_EG's avatar
      Tonio_EG
      Regular Visitor

      Yes thanks, I did the same workaround.

      But I would like to understand why the orginal approach (which is way cleaner) isn't working?

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

        Hi,

        The parameter in the outer CALCULATE DAX function is replacing the parameter in the inner CALCULATE function.

        In this case, instead of writing like this, in my opinion, writing two parameters in one CALCULATE DAX function is more clear to understand.

        I hope this helps.

        Thank you.