Forum Discussion

NilR's avatar
NilR
Icon for Post Patron rankPost Patron
5 years ago
Solved

Summarize a Table for Specific values in a column

I would like to show and add only IDs that are in 2008 . So will be adding all values except IDs like 9 and 4 that their date is not 2008 , and but will apply another date range filter at the end. Basicly using the Date=2008 as my indicator to select IDs.


here is my DAX  but can't figure out how to filter the ID.

 

 

CALCULATETABLE(SUMMARIZE('Table',
[ID], "_sum",SUMX('Table',[VALUE])), FILTER('Table', [DATE] >= 2002 && [CLM_INC_DATE] <= 2008 ))

 


as you see in Summarized table 4 and 9 are removed from calculation becuase they never had date =2008.

 

  • NilR 

    Replace the correct table and column names as per your model and add the following measure: My Table is T17

     

    SUMX (
        FILTER (
            ADDCOLUMNS (
                T17,
                "x2008", CALCULATE ( COUNTROWS ( T17 ), ALLEXCEPT ( T17, T17[ID] ), T17[DATE] = 2008 )
            ),
            [x2008] = 1
                && T17[DATE] >= 2002
                && T17[DATE] <= 2008
        ),
        T17[VALUE]
    )

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply πŸ™‚


    Website YouTube  LinkedIn

3 Replies

  • NilR 

    Can you explain what exactly is required?
    You can show the expected result as well.

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply πŸ™‚


    Website YouTube  LinkedIn

  • NilR 

    Replace the correct table and column names as per your model and add the following measure: My Table is T17

     

    SUMX (
        FILTER (
            ADDCOLUMNS (
                T17,
                "x2008", CALCULATE ( COUNTROWS ( T17 ), ALLEXCEPT ( T17, T17[ID] ), T17[DATE] = 2008 )
            ),
            [x2008] = 1
                && T17[DATE] >= 2002
                && T17[DATE] <= 2008
        ),
        T17[VALUE]
    )

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply πŸ™‚


    Website YouTube  LinkedIn

    • NilR's avatar
      NilR
      Icon for Post Patron rankPost Patron

      Fowmy  Thank You very much! How can I count those values instead of sum? becuase countx is nt working properly.