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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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