Forum Discussion

cosminc's avatar
cosminc
Icon for Post Partisan rankPost Partisan
7 years ago
Solved

Summarize new table with max year only

Hi,

i want to make a new table source with only max year data; how can i filter that

i tried this, but doesn't work

newfilteredsource =
VAR MaxYear =
    CALCULATE ( MAX ( Source[Year] )ALL ( Source ) )
RETURN
    SUMMARIZE (
        Source,
        Source[Salesmen],
        Source[Sales],
        "Year"CALCULATE (
            MAX ( Source[Year] ),
            FILTER ( Source, Source[Year] = MaxYear )
        )
    )

Thanks,

Cosmin

  • cosminc 

     

    try this revision

     

    newfilteredsource = 
    VAR MaxYear = MAX ( Source[Year] )
    RETURN
        SUMMARIZE (FILTER ( Source, Source[Year] = MaxYear ),
          Source[Salesmen],
            Source[Sales],
            "Year", MaxYear
            )
        

5 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    cosminc 

     

    try this revision

     

    newfilteredsource = 
    VAR MaxYear = MAX ( Source[Year] )
    RETURN
        SUMMARIZE (FILTER ( Source, Source[Year] = MaxYear ),
          Source[Salesmen],
            Source[Sales],
            "Year", MaxYear
            )
        
    • cosminc's avatar
      cosminc
      Icon for Post Partisan rankPost Partisan

      Hi

      i discovered that it doesn't work proper

      there is a difference somewhere

      so 2019 sum sales in the new base is different and also part of salesmen have different sum Sales

      can you help me please with this?

      Thanks,

      Cosmin