Forum Discussion

PatrickSeidl's avatar
PatrickSeidl
Frequent Visitor
8 years ago
Solved

Use value if entry is missing compared to another table

Hi all,

I have a table with SLA information. This table, however, only contains objects with violations per every hour, not those without. The table basically looks like that:

 

StateChanges:

ServerName;DateTime;HealthyPercent;CriticalPercent

serverA;2018-02-18 0:00;95;5

serverB;2018-02-18 0:00;90;10

serverC;2018-02-18 0:00;0;100

serverA;2018-02-18 1:00;90;10

serverC;2018-02-18 1:00;0;100

...

 

As you see, serverB had a violation at 0:00 but is missing at 1:00 because it was available at 100%. serverD is missing at all.

 

Further, I have another table where all servers are listed:

 

GroupTable:

ServerName;

serverA;

serverB;

serverC;

serverD;

...

 

What I am searching for is a way to show serverB with 100% healthy at every time where there was no validation. Since the time is a sliding window (last 3 months) it cannot be a fixed table and needs to be something calculated "on the fly".

Those computers without any entry in the first table should show 100% healthy.

 

At the end I am expecting data like (with the bold ones calculated):

 

ServerName;DateTime;HealthyPercent;CriticalPercent

serverA;2018-02-18 0:00;95;5

serverB;2018-02-18 0:00;90;10

serverC;2018-02-18 0:00;0;100

serverD;2018-02-18 0:00;100;0

serverA;2018-02-18 1:00;90;10

serverB;2018-02-18 1:00;100;0

serverC;2018-02-18 1:00;0;100

serverD;2018-02-18 1:00;100;0

...

 

Any ideas?

 

Thanks for your time in advance,

Patrick

 

PS: My previous post has been marked as spam, no clue why. So, sorry for posting again.

9 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    PatrickSeidl

     

    You can use this Calculated Table...I believe

     

    From the Modelling Tab>>NEw Table

     

    New Table =
    ADDCOLUMNS (
        ADDCOLUMNS (
            CROSSJOIN ( ALL ( GroupTable[ServerName] ), ALL ( StateChanges[DateTime] ) ),
            "Healthy Percent",
            VAR mycalc =
                CALCULATE (
                    SUM ( StateChanges[HealthyPercent] ),
                    FILTER (
                        StateChanges,
                        StateChanges[ServerName] = EARLIER ( [ServerName] )
                            && StateChanges[DateTime] = EARLIER ( [DateTime] )
                    )
                )
            RETURN
                IF ( ISBLANK ( mycalc ), 100, mycalc )
        ),
        "Critical Percent", 100 - [Healthy Percent]
    )