Forum Discussion

osinquinvdm's avatar
osinquinvdm
Advocate II
9 years ago
Solved

How come it is aggregating?

I have requests that can be either service requests or information requests.

I have the following 3 measures to count them:

 

Nb Requests = CALCULATE(COUNT('311_Details'[DDS]))
Nb Service Requests = CALCULATE([Nb Requests];'311_Details'[Nature]<>"Information")
Nb Info Requests = CALCULATE([Nb Requests];'311_Details'[Nature]="Information")

How come the data now shows as aggregated, instead of getting broken down by Nature.

The only change I made is to 

What coud explain such a a behaviour?

 

Thanks

  • Sean's avatar
    Sean
    9 years ago
    Nb Info Requests =
    CALCULATE (
        [Nb Requests];
        FILTER ( '311_Details'; '311_Details'[Nature] = "Information" )
    )
    
    Nb Service Requests =
    CALCULATE (
        [Nb Requests];
        FILTER ( '311_Details'; '311_Details'[Nature] <> "Information" )
    )
    
    

    osinquinvdm

    The way you had originally written these they had an implied ALL function

    FILTER ( ALL ( '311_Details'[Nature] )... => therefore ignoring any existing filter context!

    http://www.sqlbi.com/articles/filter-arguments-in-calculate/

4 Replies

  • Sean's avatar
    Sean
    Community Champion

    Change the 1st measure to

    Nb Requests = COUNT ( '311_Details'[DDS] )

     

    • osinquinvdm's avatar
      osinquinvdm
      Advocate II

      sorry about that.

      I just applied that simplification but as expected it does not make a difference.

      How do I get NB DDI to show 0 on all lines except information?

      • Sean's avatar
        Sean
        Community Champion
        Nb Info Requests =
        CALCULATE (
            [Nb Requests];
            FILTER ( '311_Details'; '311_Details'[Nature] = "Information" )
        )
        
        Nb Service Requests =
        CALCULATE (
            [Nb Requests];
            FILTER ( '311_Details'; '311_Details'[Nature] <> "Information" )
        )
        
        

        osinquinvdm

        The way you had originally written these they had an implied ALL function

        FILTER ( ALL ( '311_Details'[Nature] )... => therefore ignoring any existing filter context!

        http://www.sqlbi.com/articles/filter-arguments-in-calculate/