Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
Solved! Go to Solution.
@Hell-1934 , Better to have date column first
Date = Datevalue([QryDate])
Then have columns like
Maxx(filter( Table1, [VMID] = earlier([VMID]) && [Date] = earlier([Date]) ), [QryDate])
Power BI DAX- Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s&list=PLPaNVDMhUXGYU97pdqwoaociLdwyDRn39&index=1
Thank you, @amitchandak it worked
The code should be -
Latest SCAN Date =
MAXX(
FILTER(
Table1,
Table1[VMID] = EARLIER(Table1[VMID]) &&
DATEVALUE(Table1[QryDate]) = DATEVALUE(EARLIER(Table1[QryDate]))
),
Table1[QryDate]
)
@Hell-1934 , Better to have date column first
Date = Datevalue([QryDate])
Then have columns like
Maxx(filter( Table1, [VMID] = earlier([VMID]) && [Date] = earlier([Date]) ), [QryDate])
Power BI DAX- Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s&list=PLPaNVDMhUXGYU97pdqwoaociLdwyDRn39&index=1
User | Count |
---|---|
23 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |