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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Finding max date in group

Hi,

 

I have created a measure Failed Groups LastWeek, which counts how many groups with Group_Status "Failed" where in last week. I need to adjust measure Failed Groups LastWeek, that it would count Groups only with latest date in that week (groups' names are different). 

E.g. I outlined 4 rows with week number 27 (it's last week), and 3 of them are with status Failed. So now all of them are counted. But I need to count Groups only with the lastest GroupStartTime and then count those rows that are with Group_status "Failed".

 

Failed Groups LastWeek = CALCULATE(COUNT(SummaryAboutGroups_G[Group]), FILTER(SummaryAboutGroups_G, SummaryAboutGroups_G[Week number]=SummaryAboutGroups_G[Last Week]), FILTER(SummaryAboutGroups_G, SummaryAboutGroups_G[Group_status]="Failed") )

 

2020-07-09_10-18-58.png

 

Thanks,

Agne

3 REPLIES 3
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Do you still have issues with this?

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly. Thanks!

Cheers,
Sturla

AntrikshSharma
Super User
Super User

Try something like this:

Failed Groups LastWeek =
CALCULATE (
    COUNTROWS ( VALUES ( SummaryAboutGroups_G[Group] ) ),
    FILTER (
        SUMMARIZE (
            SummaryAboutGroups_G,
            SummaryAboutGroups_G[Week number],
            SummaryAboutGroups_G[Last Week],
            SummaryAboutGroups_G[Group_status],
            SummaryAboutGroups_G[Group],
            SummaryAboutGroups_G[GroupStartTime]
        ),
        SummaryAboutGroups_G[Group_status] = "Failed"
            && SummaryAboutGroups_G[GroupStartTime]
                = MAX ( SummaryAboutGroups_G[GroupStartTime] )
    )
)

 

Anonymous
Not applicable

@AntrikshSharma ,

Thank you for your suggestion and sorry for late reply.

Actually, it is not the right measure for this situation. As I didn't find solution yet, I'd like to describe what I want to reach again.

Maybe one measure is not enough, it could be counted separately, but here are the steps that should be done:

1. Measure should filter rows of one week (this week/last week/custom date range)

2. Measure should filter rows with latest date (GroupStartTime) per Group (show row with max date in group)

3. Measure should filter rows with Group_Status "Failed"

4. Measure should count all those rows

 

2020-08-17_16-03-10.png

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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