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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
patoku0207
Frequent Visitor

Max for date and time 2 columns

Hello, 

First,sorry for my english, I'm french.

This forum is incredible and very helpful.

I'm new and I need help for a calculated column.

I'm trying to find the value for a max date and time with filters.

 

Suffix time is a incremented number when date and time are similars.

So the very last date and time is date, max time , max suffix.

 

Itemnumberdatetimesuffix timebalance
11234520220131295311100
11234620220131357811100
19999999992022020115385411500
11234720220131295311127
21234720220131475213544
2999999999202201314562413748
245787202201314562423750
2999999999202202017588625000

 

Resultat : 

Itemnumberdatetimesuffix timebalance
1123452022013129531 
1123462022013135781 
1999999999202202011538541 
11234720220131295311127
2123472022013147521 
299999999920220131456241 
245787202201314562423750
299999999920220201758862 

 

Im trying to find the balance for each item, each date, max time and max suffix time, excluding number = 99999999.

 

Thanks for your help

Pat

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @patoku0207 ,

 

Just so I understand correctly, you would like to return the balance per item and number which has the highest date. If two dates are equal, then we shall take the higher time. If even these two times are equal, we shall take the higher time suffix. For the calculation we must not consider the rows with number = 999999999.

 

This is my result:

tomfox_0-1645295984465.png

 

This is the measure I used:

TomsBalanceMeasure = 
VAR _maxValue = 
CALCULATE (
    MAXX ( Table, Value( Table[date] & Table[time] & Table[suffix time] ) ),
    ALLEXCEPT ( Table, Table[Item] ),
    Table22[number] <> 999999999
)
RETURN
CALCULATE ( 
  MAX ( Table[balance] ), 
    VALUE ( Table[date] & Table[time] & Table[suffix time] ) == _maxValue  
)

 

Does this solve your issue? 🙂

 

/Tom

https://www.tackytech.blog/

https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

4 REPLIES 4
patoku0207
Frequent Visitor

Hello,

 

It wont let me validate the measure

 

patoku0207_0-1645302945743.png

 

Thanks for help.

Pat

 

 

 

patoku0207
Frequent Visitor

Hello tomfox,

 

Thanks for your help, this solved my issue 

 

Congrats

Pat

 

 

tackytechtom
Super User
Super User

Hi @patoku0207 ,

 

Just so I understand correctly, you would like to return the balance per item and number which has the highest date. If two dates are equal, then we shall take the higher time. If even these two times are equal, we shall take the higher time suffix. For the calculation we must not consider the rows with number = 999999999.

 

This is my result:

tomfox_0-1645295984465.png

 

This is the measure I used:

TomsBalanceMeasure = 
VAR _maxValue = 
CALCULATE (
    MAXX ( Table, Value( Table[date] & Table[time] & Table[suffix time] ) ),
    ALLEXCEPT ( Table, Table[Item] ),
    Table22[number] <> 999999999
)
RETURN
CALCULATE ( 
  MAX ( Table[balance] ), 
    VALUE ( Table[date] & Table[time] & Table[suffix time] ) == _maxValue  
)

 

Does this solve your issue? 🙂

 

/Tom

https://www.tackytech.blog/

https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

patoku0207
Frequent Visitor

Hello,

 

If its too hard, I just want to find the latest date for each date for each item.( ignore the number filter).

The latest date is a combinaison of date, max time, max suffix

 

Ex :

Item 1 : 20220131   3578 is the max time   1 is the max suffix

Item 2 : 20220131   45624 is the max time   2 is the max suffix

 

Thanks in advance for your help.

Pat

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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