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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Filter table

I have this table:

imagen 1.png

I need to get at the month level, for each DocumentTypeId, the row corresponding to its highest UpdateTime and its maximum possible StateId.

For example for the month of January:

imagen 2.png

Thank you.

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

Hi, @Syndicate_Admin 

According to your description, you want to filter the table by grouping by month according to [documentid]. Right?

Here are the steps you can follow:

(1)This is my test date:

vyueyunzhmsft_0-1662451100839.png

 

(2)We can click New Table at the top of the interfaceand enter :

Table =
SELECTCOLUMNS (
    ADDCOLUMNS (
        SUMMARIZE (
            'Test',
            'Test'[month],
            'Test'[DocumentTypeId],
            "UpdateTime", MAX ( 'Test'[UpdateTime] ),
            "Id", CALCULATE ( MAX ( 'Test'[Id] ) )
        ),
        "StateId",
            CALCULATE (
                MAX ( 'Test'[StatedId] ),
                'Test'[DocumentTypeId] = EARLIER ( [DocumentTypeId] )
                    && 'Test'[UpdateTime] = EARLIER ( [UpdateTime] )
            )
    ),
    "Id", [Id],
    "UpdateTime", [UpdateTime],
    "StateId", [StateId],
    "DocumentTypeId", [DocumentTypeId]
)

 

(3)Then we can get the table you need:

vyueyunzhmsft_1-1662451100845.png

 

If this method can't meet your requirement, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

This is my test .pbix file : Filter_Dax.pbix 

 

Best Regards,

Aniya Zhang

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

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

According to your description, you want to filter the table by grouping by month according to [documentid]. Right?

Here are the steps you can follow:

(1)This is my test date:

vyueyunzhmsft_0-1662451100839.png

 

(2)We can click New Table at the top of the interfaceand enter :

Table =
SELECTCOLUMNS (
    ADDCOLUMNS (
        SUMMARIZE (
            'Test',
            'Test'[month],
            'Test'[DocumentTypeId],
            "UpdateTime", MAX ( 'Test'[UpdateTime] ),
            "Id", CALCULATE ( MAX ( 'Test'[Id] ) )
        ),
        "StateId",
            CALCULATE (
                MAX ( 'Test'[StatedId] ),
                'Test'[DocumentTypeId] = EARLIER ( [DocumentTypeId] )
                    && 'Test'[UpdateTime] = EARLIER ( [UpdateTime] )
            )
    ),
    "Id", [Id],
    "UpdateTime", [UpdateTime],
    "StateId", [StateId],
    "DocumentTypeId", [DocumentTypeId]
)

 

(3)Then we can get the table you need:

vyueyunzhmsft_1-1662451100845.png

 

If this method can't meet your requirement, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

This is my test .pbix file : Filter_Dax.pbix 

 

Best Regards,

Aniya Zhang

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

@Syndicate_Admin , refer if my blog on a similar topic can help

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors