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
TheQ
Frequent Visitor

Retrieve Last Date a Value Changed by Group

Hi everyone,

 

I've been troubleshooting this issue for a couple hours now to no avail. Let's say I have the following dataset:

GroupDateSetting
A1/30/235.3
A1/15/235.3
A1/5/234.7
B1/30/233.2
B1/29/232.7
B1/7/232.4
C1/28/236.1
C1/17/236.1
C1/1/235.2

I want to know the date of the most recent value change in this form:

GroupMost Recent SettingDate of Last Change
A5.31/15/23
B3.21/30/23
C6.11/17/23

 

I have tried a few variations of this as a Calculated Column:

 

 

 

Date of Last Change =
VAR _Setting = SUM( Table[Setting] )
VAR _Date = Table[Date]
RETURN
CALCULATE(
     MAX( Table[Date] ),
     ALLEXCEPT( Table, Table[Group] ),
     Table[Date] < _Date,
     SUM( Table[Setting] ) <> _Setting
)

 

 

 

This usually gives me the "The true/false expression does not specify a column" error. I was able to get past this by replacing the commas with &&, but end up with blanks for the whole column.

Thanks in advance for the help!
Q

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @TheQ 

try like:

NewColumn =
VAR _group = [Group]
VAR _grouptable = 
FILTER(
     TableName, 
     TableName[Group] = _group
)
VAR _lastdate =
MAXX(
    _grouptable,
   TableName[Date]  
)
VAR _lastsetting =
MAXX(
    FILTER(
         _grouptable,
         TableName[Date]=_lastdate
    ),
   TableName[Setting]  
)
RETURN
MINX(
    FILTER(
         _grouptable,
         TableName[Setting] = _lastsetting
    ),
    TableName[Date]
)

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @TheQ 

try like:

NewColumn =
VAR _group = [Group]
VAR _grouptable = 
FILTER(
     TableName, 
     TableName[Group] = _group
)
VAR _lastdate =
MAXX(
    _grouptable,
   TableName[Date]  
)
VAR _lastsetting =
MAXX(
    FILTER(
         _grouptable,
         TableName[Date]=_lastdate
    ),
   TableName[Setting]  
)
RETURN
MINX(
    FILTER(
         _grouptable,
         TableName[Setting] = _lastsetting
    ),
    TableName[Date]
)
TheQ
Frequent Visitor

Thanks @FreemanZ ! That amazingly worked. Do you have any idea why this worked and my original method didn't? I've used my original method successfully on a similar case but where the "Setting" wasn't a number, but a "Passed"/"Failed" column.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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