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
Anonymous
Not applicable

measure to sum values in a column, filtering only for the most recent period

Hi Guys,

 

Can anybody point me in the right direction with this please?

 

I need to create a measure which sums up the values in a column, but only looks at the most recent period per plant (ignoring all the previous preiods). I've highlighted in the picture below which rows it should sum up.

 

PhoenixBird_1-1600341563982.png

So rather than adding up the values for every sinlge month per location (making the total 190), it should just look at the most recent month, so it'd calculate 13+14+2 =29.

 

Any ideas?

 

 

 

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can create a measure as below:

Measure =
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[Plant],
        "maxperiod", MAX ( 'Table'[Period] ),
        "mjFinding", MAX ( 'Table'[No of Major Findings] )
    )
RETURN
    SUMX ( _tab, [mjFinding] )

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
FrankAT
Community Champion
Community Champion

Hi @Anonymous 

take a look at the following solution:

 

21-09-_2020_11-28-53.png

Sum of No of Major Findings = SUM('Table'[No of Major Findings])

Sum of No of Minor Findings = SUM('Table'[No of Minor Findings])


Recent No of Major Findings = 
CALCULATE(
    [Sum of No of Major Findings],
    FILTER(
        ALLEXCEPT('Table','Table'[Plant]), 
        MAX('Table'[Periad]) = 'Table'[Periad]
    )
)


Recent No of Minor Findings = 
CALCULATE(
    [Sum of No of Minor Findings],
    FILTER(
        ALLEXCEPT('Table','Table'[Plant]), 
        MAX('Table'[Period]) = 'Table'[Period]
    )
)

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can create a measure as below:

Measure =
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[Plant],
        "maxperiod", MAX ( 'Table'[Period] ),
        "mjFinding", MAX ( 'Table'[No of Major Findings] )
    )
RETURN
    SUMX ( _tab, [mjFinding] )

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , You can do it like

But you need a sortable month like YYYYMM Format

 

calculate( [no of maajor finidng], filter( Table,[Month Year Sort] = max(Month Year Sort])), allexcept(Table, Table[Plant]))

 

calculate(sum(Table [no of maajor finidng]), filter( Table,[Month Year Sort] = max(Month Year Sort])), allexcept(Table, Table[Plant]))

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.