The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All
I would like to know if it possible to create a measure that get the earliest last date from table with a date and work it base and work with the filter context?
Have the following table:
Log Table
Customer Id | Machine Id | Log Date | Value |
1 | a | 2021-01-22 | 250 |
1 | a | 2021-01-23 | 265 |
2 | b | 2021-01-22 | 500 |
2 | b | 2021-01-24 | 356 |
3 | c | 2021-01-25 | 265 |
3 | c | 2021-01-26 | 541 |
4 | d | 2021-01-23 | 524 |
4 | d | 2021-01-24 | 365 |
Customer
Customer Region | Customer Area | Customer Id |
z | v | 1 |
z | v | 2 |
z | w | 3 |
x | y | 4 |
I would like the measure create the following results
Customer Region | Earlist Last Date |
z | 2021-01-23 |
x | 2021-01-24 |
Then next level
Customer Region | Customer Area | Earlist Last Log Date |
z | v | 2021-01-23 |
z | w | 2021-01-26 |
x | y | 2021-01-24 |
I try create the measure like
'Log Table'[Last Script Log Date] =
VAR CurrentLastDate = MINX(
CALCULATETABLE('Log Table',
'Log Table'[MachineId] = 'Log Table'[MachineId]
, LASTDATE('Log Table'[Log Date])
)
,'Log Table'[Log Date])
RETURN IF(ISBLANK( CurrentLastDate ),DATE(1,1,1),CurrentLastDate )
Solved! Go to Solution.
Please try this measure expression, replacing T1 for your actual table name.
Min Max =
VAR vMaxDates =
SUMMARIZE (
T1,
T1[Customer Id],
"cMaxDate", MAX ( T1[Log Date] )
)
RETURN
MINX (
vMaxDates,
[cMaxDate]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this measure expression, replacing T1 for your actual table name.
Min Max =
VAR vMaxDates =
SUMMARIZE (
T1,
T1[Customer Id],
"cMaxDate", MAX ( T1[Log Date] )
)
RETURN
MINX (
vMaxDates,
[cMaxDate]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
had trouble interpreting your question.
best guess.
mFirstLogDate:=MIN(tblLog[Date])
mLastLogDate:=MAX(tblLog[Date])
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |