Hello,
I am trying to fetch the recent data not only to the recent date but to the recent time as well and then provide the count of that data afterwards. I am trying multiple queries provided in the forum but none has worked so far.
The data is something like this and the yellow rows are the recent record. Please provide me with a solution weather I should do it as a calculated columns or a measure. And if a new column has to be made, how should I do that.
Solved! Go to Solution.
Hi @Anonymous
Here's your sample file https://www.dropbox.com/t/njvPDqHidpQ3dSxs
You can create a calculated column that checks which rows to keep:
Keep? =
VAR CurrentDate = Data[DateTimeFetched (ST 24hrs)]
VAR CurrentServer = Data[ServerName]
VAR EachServerTable =
FILTER (
Data,
Data[ServerName] = CurrentServer
)
VAR LastDateTimeFetched =
MAXX (
EachServerTable,
Data[DateTimeFetched (ST 24hrs)]
)
RETURN
IF (
CurrentDate = LastDateTimeFetched,
"Yes"
)
Then create a new calculated table that keeps only the required rows:
Filetered Table =
FILTER (
Data,
NOT ISBLANK ( Data[Keep?] )
)
Your measure would be just the COUNTROWS of this table
Hello Tamerj,
Thanks for the solution you provided and your solution worked nicly for me and it did solved my issue.
However there is one scenario that I am facing with the solution. We are providiing the latest date time for all the servers whatever the last latest date it is in the data. But I want to give only the latest time with respect to the todays date. To simplyfy the problem I am attaching the screenshot of it below.
Can you please help me out here. Thanks in advance.
Hi @Anonymous
Here's your sample file https://www.dropbox.com/t/njvPDqHidpQ3dSxs
You can create a calculated column that checks which rows to keep:
Keep? =
VAR CurrentDate = Data[DateTimeFetched (ST 24hrs)]
VAR CurrentServer = Data[ServerName]
VAR EachServerTable =
FILTER (
Data,
Data[ServerName] = CurrentServer
)
VAR LastDateTimeFetched =
MAXX (
EachServerTable,
Data[DateTimeFetched (ST 24hrs)]
)
RETURN
IF (
CurrentDate = LastDateTimeFetched,
"Yes"
)
Then create a new calculated table that keeps only the required rows:
Filetered Table =
FILTER (
Data,
NOT ISBLANK ( Data[Keep?] )
)
Your measure would be just the COUNTROWS of this table
Hello Samarth,
Thanks for your time and valuabel reply. I tried the above provided solution but sadly it is not giving me the expected result.
Let me modify my question...
I want to calculate the number of servers (count) as in how many are Registered/Unregistered and Working/Not working on the "latest date and time" (in yellow) and display the count in a card. I think we need to write some measure here. I tried some measure but it didnt work for me.
As I cannot put the actual data here but this is somehow my use case. Now assume this data for some 100k record.
Hi @Anonymous ,
There are certain way to achive this:-
1. You can directly drag DateTimeFetched column on your visual and mark summerization as Latest.
2. Create a measure with below code and use it on your visual:-
Measure = MAX('Table'[DateTimeFetched])
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!