Forum Discussion
Latest values from table
- Anonymous5 years ago
Hi munnaz ,
According to my understand , you want to display the lastest installed date ,the lastest but not blank comment and the latest measurement, right?
You could use the following formula after doing "Merge" . Here is the pbix file.
1.The latest installed
LastInstalled = CALCULATE ( MAX ( 'COMPONENTID'[INSTALLED DATE] ), ALLEXCEPT ( COMPONENTID, COMPONENTID[ASSET ID] ) )2.The latest comment
lastComment = VAR hasBlank = IF ( MAX ( 'Merge1'[Comments] ) = BLANK (), 0, 1 ) VAR sumBlank = SUMX ( FILTER ( ALL ( 'Merge1' ), [ASSETID] = MAX ( 'Merge1'[ASSETID] ) && [Name] = MAX ( 'Merge1'[Name] ) ), hasBlank ) VAR _lastComment = MAXX ( FILTER ( ALL ( Merge1 ), [ASSETID] = SELECTEDVALUE ( Merge1[ASSETID] ) && [Name] = SELECTEDVALUE ( Merge1[Name] ) && NOT ( ISBLANK ( Merge1[Comments] ) ) && [DateOccured] = CALCULATE ( MAX ( Merge1[DateOccured] ), FILTER ( ALL ( 'Merge1' ), [ASSETID] = SELECTEDVALUE ( Merge1[ASSETID] ) && [Name] = SELECTEDVALUE ( Merge1[Name] ) && [Comments] <> "" ) ) ), [Comments] ) RETURN IF ( sumBlank = 0, BLANK (), _lastComment )3.Apply this measure to filter (set as "1") for last measurement.
rank = RANKX ( FILTER ( ALL ( Merge1 ), 'Merge1'[ASSETID] = MAX ( 'Merge1'[ASSETID] ) && 'Merge1'[Name] = MAX ( 'Merge1'[Name] ) ), CALCULATE ( MAX ( ( 'Merge1'[DateOccured] ) ) ), , DESC )My visualization looks like this:
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.Best Regards,
Eyelyn Qin
Hi munnaz ,
According to my understand , you want to display the lastest installed date ,the lastest but not blank comment and the latest measurement, right?
You could use the following formula after doing "Merge" . Here is the pbix file.
1.The latest installed
LastInstalled =
CALCULATE (
MAX ( 'COMPONENTID'[INSTALLED DATE] ),
ALLEXCEPT ( COMPONENTID, COMPONENTID[ASSET ID] )
)2.The latest comment
lastComment =
VAR hasBlank =
IF ( MAX ( 'Merge1'[Comments] ) = BLANK (), 0, 1 )
VAR sumBlank =
SUMX (
FILTER (
ALL ( 'Merge1' ),
[ASSETID] = MAX ( 'Merge1'[ASSETID] )
&& [Name] = MAX ( 'Merge1'[Name] )
),
hasBlank
)
VAR _lastComment =
MAXX (
FILTER (
ALL ( Merge1 ),
[ASSETID] = SELECTEDVALUE ( Merge1[ASSETID] )
&& [Name] = SELECTEDVALUE ( Merge1[Name] )
&& NOT ( ISBLANK ( Merge1[Comments] ) )
&& [DateOccured]
= CALCULATE (
MAX ( Merge1[DateOccured] ),
FILTER (
ALL ( 'Merge1' ),
[ASSETID] = SELECTEDVALUE ( Merge1[ASSETID] )
&& [Name] = SELECTEDVALUE ( Merge1[Name] )
&& [Comments] <> ""
)
)
),
[Comments]
)
RETURN
IF ( sumBlank = 0, BLANK (), _lastComment )
3.Apply this measure to filter (set as "1") for last measurement.
rank =
RANKX (
FILTER (
ALL ( Merge1 ),
'Merge1'[ASSETID] = MAX ( 'Merge1'[ASSETID] )
&& 'Merge1'[Name] = MAX ( 'Merge1'[Name] )
),
CALCULATE ( MAX ( ( 'Merge1'[DateOccured] ) ) ),
,
DESC
)My visualization looks like this:
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
- munnaz5 years agoFrequent Visitor
Amazing! You're a legend Anonymous !!! Thank you so much for this