Forum Discussion

Hell-1934's avatar
Hell-1934
New Member
1 year ago
Solved

Creating Calculated Column based on the ID, and the most recent datetime column in DAX

I have the following 1K ++ records table in my PBI report with Virtual Machine's IDs and Scan date-time info:

Table1 (this is a data snapshot, example)

 

I need to create [QryDate_Upd] - calculated column, which will do the following -
If there are the same VMIDs, same QryDates -> then it should select the most highest date-time value

otherwise it should just copy the values from the QryDate column
For example, for VMID = hh-3355, there are QryDate dates = 10/01/2020 and 10/15/2021. I need the calculated column to determine the highest date-time value for 10/01/2020, which is 8 50 PM

I expect the following outcome:

 

I have the following DAX code for this

 

QryDate_upd = 
CALCULATE(
    MAX(Table1[QryDate]),
    ALLEXCEPT(Table1, Table1[VMID], Table1[QryDate].[Date])
)

 

But the problem is that my [QryDate] field related to a [Date] field in my Date calendar table

The code above only lets me use  Table1[QryDate].[Date] field - only if I remove the Date tbl relation

Wondering, if there more efficient way to create this calculated column?
 

 

2 Replies