Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
stefan321
Frequent Visitor

get last online Date

I have the following table:

stefan321_0-1712828288547.png

Like to have a measure where i get the last "Online" (see Status column) date (Column Time) from each Server.

For example in that way:

stefan321_1-1712828357243.png

 

1 ACCEPTED SOLUTION

hi, @stefan321 

 

try below measure

for lastonline

Measure = 
var a= MAXX(
          FILTER(
            ALL('Table'),
            'Table'[server]=MAX('Table'[server]) && 'Table'[status]="online"),
            'Table'[time]
        )
Return
If(min('table'[time])=a&& MIN('Table'[status])="online","lastonline","No")

Dangar332_0-1713026678150.png

 

 

 

use below measure for visual filter

slicer = 
IF(
    [Measure]=SELECTEDVALUE('status'[Value]),
    1,
    IF(SELECTEDVALUE('status'[Value])=BLANK(),1,0))

Dangar332_1-1713026810151.png

 

 

 

make a table of  'status'

status = {("lastOnline"),("No")}

 

 you can download file from below

 

 

View solution in original post

5 REPLIES 5
v-heq-msft
Community Support
Community Support

Hi @stefan321 ,
Thanks for @Dangar332  reply.
Here's my alternative approach and additions
Create a meaure

LastOnline = 
VAR _MaxTime = 
CALCULATE(
    MAX('Table'[Time]),
    FILTER(
        ALLEXCEPT(
        'Table',
        'Table'[Server]
    ),
        'Table'[Status] = "Online"
    )
)
RETURN
IF(
    SELECTEDVALUE('Table'[Time]) = _MaxTime,
    "lastOnline",
    "No"
)

Output

vheqmsft_0-1712905733049.png

Next up is how to filter using meaure
Create a table2

Table 2 = 
SUMMARIZE(
    'Table',
    'Table'[Time],
    "Type",'Table'[LastOnline]
)

vheqmsft_1-1712905818535.png
Use type as slicer value
Create another meaure

Slicer = 
IF(
    'Table'[LastOnline] = SELECTEDVALUE('Table 2'[Type]),
    1,
    IF(
        SELECTEDVALUE('Table 2'[Type]) = BLANK(),
        1,
        0
    )
)

Use the meaure as filter of this visual and set it "is 1"

vheqmsft_2-1712905964176.png

Final output

vheqmsft_3-1712905982540.pngvheqmsft_4-1712905995676.png

vheqmsft_5-1712906014154.png

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 



Hi Albert

ist works! thanks a ton! really a nice solution 🙂

i have just a small issue: Sometimes i have The same timestamp for a Server whith multiple Instances. So for example:

Screenshot 2024-04-12 145625.jpg

Unfortunately your solution shows in that case all Status entries, but i want to have Online only. Do you have a easy solution for that? Thanks

hi, @stefan321 

 

try below measure

for lastonline

Measure = 
var a= MAXX(
          FILTER(
            ALL('Table'),
            'Table'[server]=MAX('Table'[server]) && 'Table'[status]="online"),
            'Table'[time]
        )
Return
If(min('table'[time])=a&& MIN('Table'[status])="online","lastonline","No")

Dangar332_0-1713026678150.png

 

 

 

use below measure for visual filter

slicer = 
IF(
    [Measure]=SELECTEDVALUE('status'[Value]),
    1,
    IF(SELECTEDVALUE('status'[Value])=BLANK(),1,0))

Dangar332_1-1713026810151.png

 

 

 

make a table of  'status'

status = {("lastOnline"),("No")}

 

 you can download file from below

 

 

Dangar332
Super User
Super User

Hi, @stefan321 

Try below measure

Var a= 
Maxx(
 filter(all(table),
 table[server]=max(table[server]) && table[status]="online"),
 table[time]
)
Return
If(min(table[time])=a,"lastonline","No")

Fantastic! it works 

Thanks a lot 🙂

Now i have another question. How can i visual that measure with a slicer or checkbox? Want to easily swtich between "No" and "lastonline"
Thanks

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors