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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PatrickSeidl
Frequent Visitor

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.

2 ACCEPTED SOLUTIONS

@PatrickSeidl

 

Please see attached file with your sample data

 

usevalue.png


Regards
Zubair

Please try my custom visuals

View solution in original post

@PatrickSeidl

 

File attached here as well

 

2val.png


Regards
Zubair

Please try my custom visuals

View solution in original post

9 REPLIES 9
Zubair_Muhammad
Community Champion
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]
)

Regards
Zubair

Please try my custom visuals

@PatrickSeidl

 

Please see attached file with your sample data

 

usevalue.png


Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad,

now it's getting a bit more complicated...

 

In the StateChanges I have "Warning Percent" as well (I did not mention yet for keeping it simple but probably that wasn't a good idea). So, simply calc 100 - "Healthy Percent" does not help and my other calculations (SUM, AVG) take the same value for all rows. No idea how to move on from here.

 

Probably you could help again?

 

Thanks again and all the best from Austria,

Patrick

@PatrickSeidl

 

Please could you post some sample data and expected results


Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad

 

Sure, here you go...

 

StateChanges:

ServerName;DateTime;HealthyPercent;WarningPercent;CriticalPercent

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

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

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

serverA;2018-02-18 1:00;85;5;10

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

...

 

GroupTable:

ServerName;

serverA;

serverB;

serverC;

serverD;

...

 

Result:

ServerName;DateTime;HealthyPercent;WarningPercent;CriticalPercent

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

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

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

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

serverA;2018-02-18 1:00;85;5;10

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

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

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

...

 

Guess that is what it is supposed to look.

 

Thanks again,

Patrick

Hi @PatrickSeidl

 

My apologies for late reply

There is too much work these days in my office

 

Hopefully this will work

 

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",
    VAR result =
        LOOKUPVALUE (
            StateChanges[CriticalPercent],
            StateChanges[ServerName], [ServerName],
            StateChanges[DateTime], [DateTime]
        )
    RETURN
        IF ( ISBLANK ( result ), 0, result ),
    "Warning Percent",
    VAR result =
        LOOKUPVALUE (
            StateChanges[WarningPercent],
            StateChanges[ServerName], [ServerName],
            StateChanges[DateTime], [DateTime]
        )
    RETURN
        IF ( ISBLANK ( result ), 0, result )
)

Regards
Zubair

Please try my custom visuals

@PatrickSeidl

 

File attached here as well

 

2val.png


Regards
Zubair

Please try my custom visuals

This is amazing, thank you so much!

Hi,

this is awesome, thank you so much.

 

All the best,

Patrick

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.