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

Formula to Count only latest records

Hi team, 

I've spent quite a few days looking at similar requests to only count the latest values but cannot find a solution that returns the values I need to count.

 

I have a table for Meeting Minutes and I need to count only the actions raised in the last meeting held.

 

We can have the same date for different Meeting Names so I want to count the total value of the Actions raised for the maximum Meeting Number for that unique Meeting name.

 

Table looks something like this

Meeting DateMeeting NameMeeting NumberItem NumberAction raised
11/12/2020Issues Meeting88131-011
11/12/2020Issues Meeting88132-010
01/01/2021Marketing Meeting01001-011
01/01/2021Marketing Meeting01002-060
01/01/2021Marketing Meeting01003-021
01/01/2021Sales Meeting35008-011
01/01/2021Sales Meeting35009-011
15/03/2021Marketing Meeting02005-091
15/03/2021Marketing Meeting02007-030
15/03/2021Marketing Meeting02010-051
15/03/2021Sales Meeting36001-011
15/03/2021Sales Meeting36002-010
15/03/2021Sales Meeting36002-021
19/03/2021Marketing Meeting03022-011
19/03/2021Marketing Meeting03031-001
19/03/2021Marketing Meeting03035-011

 

I want to be able to drop the measture onto a CARD visual or similar to show

Total Issues Actions raised = 1

Total Marketing Actions raised = 3

Total Sales Actions raised = 2

 

I can't seem to put together a dax formula to count the total of the "Actions Raised" column based on the highest meeting number for a specific meeting name.

 

I would really appreciate any help with this!

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

Hi @Anonymous ,

 

Or do it like this? You just need to create one measure, but you need to add the [Meeting Name] field to visualize the measure.

v-lionel-msft_0-1618465954531.png

Measure = 
VAR maxdate =
    CALCULATE (
        MAX ( 'Table'[Meeting Date] ),
        FILTER(
           ALL( 'Table'),
            'Table'[Meeting Name] = MAX('Table'[Meeting Name])
        )
    )
RETURN
CALCULATE(
    SUM('Table'[Action raised]),
    FILTER(
        ALL('Table'),
        'Table'[Meeting Name] = MAX('Table'[Meeting Name]) &&
        'Table'[Meeting Date] = maxdate
    )
)

 

Best regards,
Lionel Chen

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

7 REPLIES 7
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

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

v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Or do it like this? You just need to create one measure, but you need to add the [Meeting Name] field to visualize the measure.

v-lionel-msft_0-1618465954531.png

Measure = 
VAR maxdate =
    CALCULATE (
        MAX ( 'Table'[Meeting Date] ),
        FILTER(
           ALL( 'Table'),
            'Table'[Meeting Name] = MAX('Table'[Meeting Name])
        )
    )
RETURN
CALCULATE(
    SUM('Table'[Action raised]),
    FILTER(
        ALL('Table'),
        'Table'[Meeting Name] = MAX('Table'[Meeting Name]) &&
        'Table'[Meeting Date] = maxdate
    )
)

 

Best regards,
Lionel Chen

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

 

 

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the sample pbix file's link down below, whether it is what you are looking for.

All measures are in the sample pbix file.

 

https://www.dropbox.com/s/jpbg7dgqdsfzx8z/globet.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Hi there, those measures look good but I have an unlimited number of meeting names (users can create new meetings at any time) so is there a way for the measure to compare meeting name and maximum meeting number to determine if the actions should be counted without needing to write out measures for hundreds of different meeting names?

amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Measure =
VAR __id = MAX ('Table'[IDU] )
VAR __date = CALCULATE ( MIN('Table'[DATE] ), ALLSELECTED ('Table' ), 'Table'[IDU] = __id )
CALCULATE ( Count ('Table'[Item Number] ), VALUES ('Table'[IDU] ),'Table'[IDU] = __id,'Table'[DATE] = __date )

 

 

Anonymous
Not applicable

Hi @amitchandak this looks good but in the visual it is only showing me 3 Meetings with Actions. I need to see all Meeting Names that have Actions raised. There are 57 different meeting names. 

Globetrotter_0-1618248050710.png

 

Anonymous
Not applicable

Measure =
VAR __ID = MAX('05 MoM'[Meeting Number])
VAR __DATE = CALCULATE(
MIN('05 MoM'[Date]), ALLSELECTED('05 MoM'), '05 MoM'[Meeting Number] = __ID)
RETURN
CALCULATE(
COUNT('05 MoM'[Meeting Number]),
VALUES('05 MoM'),'05 MoM'[Meeting Number]=__ID,'05 MoM'[Date]=__DATE)

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.

Top Solution Authors