Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cosminc
Post Partisan
Post Partisan

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

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@cosminc 

 

try this revision

 

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

Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

@cosminc 

 

try this revision

 

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

Regards
Zubair

Please try my custom visuals

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

Hi
Could you copy paste some sample data with expected results.

Regards
Zubair

Please try my custom visuals

Hi,

i used the answer on another post where i wanted to do unique values for Salesmen and sum of Sales 

Test293Out = 
VAR _MaxYear = MAX(Test293Summarize[Year])
RETURN SUMMARIZE(FILTER(Test293Summarize,Test293Summarize[Year]=_MaxYear),Test293Summarize[Salesman],"Sales",SUM(Test293Summarize[Sales]))

https://community.powerbi.com/t5/Desktop/new-table-summarised-in-a-pivot-but-with-sum/m-p/659951#M31...

 

Thanks for your help,

Cosmin 

Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.