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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Mario_Nistal
New Member

Wrong Max date returned

Hello everyone, my data set has these columns:

Capture.JPG

 

But when I am creating a measure:

MaxDate = MAX(Query1[Soak Start Date])
 
This is what I am getting:
Mario_Nistal_0-1634529272699.png

 

Any hints and help to help me get the correct Latest date in the data set (1/1/2022) will be greatly appreciated. TIA! ❤️

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Mario_Nistal ,

You can not use DateTime format and Date format at the same time in a column in Power BI Desktop, it would be changed to text type.

You need to change the type to both datetime or both date type, then create the previous measure to get the MaxDate.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TZBLjsMwDEOvUmQ9gER9aoe7HmCA2Qe5/zXq1COnKwN6FknxODaI7WJqeDhdOd6/3+38OTaTXnNzZjxeNQcmgFGD0NpwgU0SjKTbF4gJnlRj9NJyMV9asRPxRdokOaa0XlohqBVQk7nEUqxMsjGt5k3+laBX3tAbWK+8aYTfwHXFsmGzFxn/o1Z0Z+AGjnIPJ7LAKPc5QaePQ5Y7dNU1gl0VL5er4Jyo0ZPR6vqxgb5I0FcvkI+/bef5Bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Soak Start Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Soak Start Date", type text}}),
    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Changed Type", {{"Soak Start Date", type datetime}}, "en-US")
in
    #"Changed Type with Locale"

If you do not want to show time, you can change the format to short date:

vyingjl_0-1634714276673.png

 

Best Regards,
Community Support Team _ Yingjie Li
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-yingjl
Community Support
Community Support

Hi @Mario_Nistal ,

You can not use DateTime format and Date format at the same time in a column in Power BI Desktop, it would be changed to text type.

You need to change the type to both datetime or both date type, then create the previous measure to get the MaxDate.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TZBLjsMwDEOvUmQ9gER9aoe7HmCA2Qe5/zXq1COnKwN6FknxODaI7WJqeDhdOd6/3+38OTaTXnNzZjxeNQcmgFGD0NpwgU0SjKTbF4gJnlRj9NJyMV9asRPxRdokOaa0XlohqBVQk7nEUqxMsjGt5k3+laBX3tAbWK+8aYTfwHXFsmGzFxn/o1Z0Z+AGjnIPJ7LAKPc5QaePQ5Y7dNU1gl0VL5er4Jyo0ZPR6vqxgb5I0FcvkI+/bef5Bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Soak Start Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Soak Start Date", type text}}),
    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Changed Type", {{"Soak Start Date", type datetime}}, "en-US")
in
    #"Changed Type with Locale"

If you do not want to show time, you can change the format to short date:

vyingjl_0-1634714276673.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

wdx223_Daniel
Community Champion
Community Champion

please make sure all these column are dates.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.