Forum Discussion
Value from max date
- 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.
We have this function in latest release - lastnonblankvalue . I have tested for this case. But try like
https://docs.microsoft.com/en-us/dax/lastnonblankvalue-function-dax
calculate(max(table[tag_id]),filter(table,table[event_raised] = lastnonblankvalue(machine_id,event_raised)))
- lukasjar6 years ago
Resolver I
I received a value for 3/11 MachineId. Don't understnad why it wouldnt return the other ones.
- Anonymous6 years agoNot applicable
measure is automatically filtering for those rows only which are in filter context with non blank values.
Measure 3 =var domain=SELECTEDVALUE('Table'[Domain])var max_date__=calculate(max('Table'[date]),FILTER(ALL('Table'),'Table'[Domain]=domain))returnCALCULATE(MAX('Table'[Status]),FILTER(all('Table'),'Table'[Domain]=domain && 'Table'[Date]=max_date__))i have modified return section and added "all", this will return all table rows.Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.- lukasjar6 years ago
Resolver I
Got this error now.
A single value for column 'TagId' in table 'Events' cannot be determined....I do not have any filters active in my filter fields.
Measure 3 =var domain=SELECTEDVALUE('Events'[MachineId])var max_date__=calculate(max('Events'[EventRaised]);FILTER(ALL('Events');'Events'[MachineId]=domain))returnCALCULATE(MAX('Events'[TagId];FILTER(ALL('Events');'Events'[MachineId]=domain && 'Events'[EventRaised]=max_date__)))