Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Everyone, I'm trying to use a calculated column to identify which rows are the latest row for their respective serial. The third column in the following table, is the calculated column I would like to create.
What I want:
SERIAL | DATE | ISLATEST
SERIAL1 | JAN 1 2020 | 0
SERIAL1 | JAN 2 2020 | 1
SERIAL2 | JAN 4 2020 | 1
SERIAL2 | JAN 3 2020 | 0
=IF(v_head_shots[IgnitionTimestamp]=CALCULATE(MAX(v_head_shots[IgnitionTimestamp]),ALL(v_head_shots)),1,0)
I have attempted the following, but so far it's only identifying the latest date for the whole table.
What I'm getting:
SERIAL | DATE | ISLATEST
SERIAL1 | JAN 1 2020 | 0
SERIAL1 | JAN 2 2020 | 0
SERIAL2 | JAN 4 2020 | 1
SERIAL2 | JAN 3 2020 | 0
Please help me identify what I'm doing wrong.
Solved! Go to Solution.
@REKLP , Create a new column like
if([date] = maxx(filter(table,[SERIAL]= earlier([SERIAL])),[Date]),1,0)
@REKLP - Perhaps:
ISLATEST Column =
VAR __Serial = [Serial]
VAR __Date = [Date]
VAR __Max = CALCULATE(MAX([DATE]),FILTER('Table',[SERIAL]=__Serial))
RETURN
IF(__Date = __Max),1,0)
ISLATEST Mesure =
VAR __Serial = MAX([Serial])
VAR __Date = MAX([Date])
VAR __Max = CALCULATE(MAX([DATE]),FILTER(ALL('Table'),[SERIAL]=__Serial))
RETURN
IF(__Date = __Max),1,0)
You may also find this helpful: See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __Previous = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Value])
RETURN
__Current - __Previous
@REKLP , Create a new column like
if([date] = maxx(filter(table,[SERIAL]= earlier([SERIAL])),[Date]),1,0)
User | Count |
---|---|
47 | |
26 | |
21 | |
17 | |
15 |
User | Count |
---|---|
53 | |
34 | |
17 | |
17 | |
15 |