Forum Discussion
lukasjar
Resolver I
6 years agoValue from max date
Hello Community. I am trying to retrieve the TagId at Max EventRaised for each MachineID in a Direct Query. From the picture below. 31207 = Press.31207.Störning1Utast1 Kit_Pack1 = KITLinan.Pac...
- Anonymous6 years ago
share your pbix.
and where are you adding this query
select A.* from dbo.events a
left join (select MachineID,max(EventRaised) _EVENT from dbo.[events]
Group by MachineID) b ON A.MachineID=B.MachineID AND a.EventRaised=B._EVENT
WHERE b._EVENT IS NOT NULLGet Data->Select Sql server -> ENter server name & database name->DirectQuery Mode-> Click on advance -> paste this query there ->
And load your data.
this will give you direct result set
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
Mariusz
Community Champion
6 years agoHi lukasjar
Try this measure
Measure =
VAR __maxEventRaised =
CALCULATE(
MAX( 'Table'[EventRaised] ),
ALLEXCEPT( 'Table', 'Table'[MachineId] )
)
RETURN
CALCULATE(
SELECTEDVALUE( 'Table'[TagId] ),
'Table'[EventRaised] = __maxEventRaised
)
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
lukasjar
Resolver I
6 years agoHi Mariusz.
It returns blank.