Forum Discussion

dyee4613's avatar
dyee4613
Helper I
5 years ago

Calculate ALL Help

Hi.  I have a some data has the following data: Contract, Date ,Employee, Hours, Task.  Here is a table w/ hours summarized at the contract level.

 

ContractHours
ABC1000
CDE2000
EFG3000


I want to be able to filter by date/contract but ignore task.  I figure the calculation is Contract Hours = Calculate(SUM[Hours]),ALL(Task))


Here is my expectation.

ContractTaskContract HoursHours
ABC11000250
ABC21000250
ABC31000250
ABC41000250
CDE12000500
CDE22000500
CDE32000500
CDE42000500
EFG13000600
EFG23000600
EFG33000600
EFG43000600
EFG53000600

 

However, the results are very different.  I figure this should be a pretty easy but I'm definitely missing something.  

2 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    dyee4613 

    Using  ALLEXCEPT(table, table[contract]) as the filter expression will solve this. However, as always, it depends on how your model is set up and which fields you are using (Dimension tables, date table...) in your target visual.

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi dyee4613 , I tested your measure and it works well to display your expectation in the table visual. I also tested another measure using ALLEXCEPT function which also works as below. Can you check or confirm is there any other fields used in the visual or any filters applied which may affect the context for the measure?

     

    Contract Hours = Calculate(SUM('Table (2)'[Hours]),ALL('Table (2)'[Task]))
    Contract Hours 2 = Calculate(SUM('Table (2)'[Hours]),ALLEXCEPT('Table (2)','Table (2)'[Contract]))

     

    Here is the sample data I used:

    And the table visual result:

     

    Best Regards,

    Community Support Team _ Jing Zhang

    If this post helps, please consider Accept it as the solution to help other members find it.