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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PC2022
Helper III
Helper III

Latest entry in the report

I have multiple "planned activities" entries in my Dataverse (Project for the Web). On the report i need to indicate the latest entry. How would i do it?

 

PC2022_0-1733250541274.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @PC2022 ,

 

try like:

measure =

MAXX(

    TOPN(1, data, data[date]),

    data[plannedactivities]

)

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but if you want to approach to this in Power Query Editor to create [latest_flag] column, one of ways is to try something like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1733372971747.png

 

 

let
    Source = project_source,
    #"Sorted Rows" = Table.Sort(Source,{{"reportingdate", Order.Descending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"group"}, {{"latestreportdate", each List.Max([reportingdate]), type nullable date}}),
    Custom1 = Source,
    #"Merged Queries" = Table.NestedJoin(Custom1, {"group"}, #"Grouped Rows", {"group"}, "Custom1", JoinKind.Inner),
    #"Expanded Custom1" = Table.ExpandTableColumn(#"Merged Queries", "Custom1", {"latestreportdate"}, {"Custom1.latestreportdate"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Custom1", "latest_flag", each if [reportingdate] = [Custom1.latestreportdate] then 1 else 0),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"group", "plannedactivities", "reportingdate", "latest_flag"})
in
    #"Removed Other Columns"

 

 

Or, if you want to approach to this problem by creating calcualted column, please check the below picture and the same attached pbix file.

 

Jihwan_Kim_1-1733373934976.png

 

 

latest_flag CC =
VAR _group = project_source[group]
VAR _reportdate = project_source[reportingdate]
VAR _flagtable =
    SELECTCOLUMNS (
        FILTER (
            ADDCOLUMNS (
                project_source,
                "@RankByLatest",
                    RANK (
                        SKIP,
                        project_source,
                        ORDERBY ( project_source[reportingdate], DESC ),
                        ,
                        PARTITIONBY ( project_source[group] ),
                        MATCHBY (
                            project_source[group],
                            project_source[plannedactivities],
                            project_source[reportingdate]
                        )
                    )
            ),
            [@RankByLatest] = 1
        ),
        "@group", project_source[group],
        "@latestdate", project_source[reportingdate]
    )
RETURN
    COUNTROWS (
        FILTER ( _flagtable, [@group] = _group && [@latestdate] = _reportdate )
    )

 

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
FreemanZ
Super User
Super User

hi @PC2022 ,

 

try like:

measure =

MAXX(

    TOPN(1, data, data[date]),

    data[plannedactivities]

)

This worked! Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.