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
huguest
Advocate II
Advocate II

Report the latest or blank date value

Hello,

 

I have top level issues that can have one or more items underneath it.  I am trying to report the completion date for each Issue that represents the completion of the latest item for that Issue. 

 

The first table is an example of the table with Issues and Items (+ Completion Date), and I need help getting the Completion Date in the second table (without the Item).

 

IssueItemCompletion Date
51112017-01-01
5121 
51312017-01-01
51322017-01-31
51412017-01-01
5142 

 

IssueCompletion Date
5112017-01-01
512 
5132017-01-31
514 

 

"Latest" gives me the date of the last completed item, but it doesn't quite work if I have issues that haven't been completed yet.  

 

If I have multiple items and one of them has not been completed yet, I need the date value for that issue to remain blank. 

 

Thanks.

1 ACCEPTED SOLUTION

A Power Query solution:

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Issue", Int64.Type}, {"Item", Int64.Type}, {"Completion Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Issue"}, {{"Completion Date", each Table.Max(_,"Item")[Completion Date], Value.Type(#"Changed Type")}})
in
    #"Grouped Rows"
Specializing in Power Query Formula Language (M)

View solution in original post

4 REPLIES 4
huguest
Advocate II
Advocate II

@Zubair_Muhammad thank you for your help.  I tried it but got an error while trying to create the Table "A table of multiple values was supplied where a single value was expected"....

 

I tied another approach where I copied the date column and replaced the balnk dates with 2999-12-31.  That allows me to get those using "latest".

 

Hugues.

A Power Query solution:

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Issue", Int64.Type}, {"Item", Int64.Type}, {"Completion Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Issue"}, {{"Completion Date", each Table.Max(_,"Item")[Completion Date], Value.Type(#"Changed Type")}})
in
    #"Grouped Rows"
Specializing in Power Query Formula Language (M)
Zubair_Muhammad
Community Champion
Community Champion

Hi @huguest

 

Please try this

 

Go to Modelling TAB>>>> NEW TABLE .......Then Enter this formula

 

New Table =
SUMMARIZE (
    TableName,
    TableName[Issue],
    "Completion Date",
    VAR mymax =
        CALCULATE ( MAX ( TableName[Item] ), ALLEXCEPT ( TableName, TableName[Issue] ) )
    RETURN
        CALCULATE (
            VALUES ( TableName[Completion Date] ),
            FILTER ( VALUES ( TableName ), TableName[Item] = mymax )
        )
)

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.