Forum Discussion

virus190's avatar
virus190
Helper II
6 years ago
Solved

Reporting FireDepartment Duration until arrived

Hi,   i dont get any further, maybe i can get some help here, this is the last thing i need for my reporting.   So i created some sample Data. Download the .pbix   In one table i have all opera...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi virus190 

    I build this column by dax.

    Firstly build a rank column sorted by OperationID and Vehicle.

    RANK = 
    RANKX (
        FILTER (
            AlarmedResources,
            AlarmedResources[Vehicle] = EARLIER ( AlarmedResources[Vehicle] )
                && AlarmedResources[OperationID] = EARLIER ( AlarmedResources[OperationID] )
        ),
        AlarmedResources[AlarmedResourcesID],
        ,
        ASC
    )

    Then build a combine column:

    CountVehicle = COMBINEVALUES(" ",AlarmedResources[Vehicle],AlarmedResources[RANK])

    Result:

    And Divide the first two Firetrucks , the first Turntable Ladder into Group1 and the third Firetruck, the second Turntable Ladder into Group2.

    Group = 
    IF (
        OR (
            AND ( AlarmedResources[Vehicle] = "Firetruck", AlarmedResources[RANK] <= 2 ),
            AND (
                AlarmedResources[Vehicle] = "Turntable Ladder",
                AlarmedResources[RANK] <= 1
            )
        ),
        "Group1",
        IF (
            OR (
                AND ( AlarmedResources[Vehicle] = "Firetruck", AlarmedResources[RANK] = 3 ),
                AND (
                    AlarmedResources[Vehicle] = "Turntable Ladder",
                    AlarmedResources[RANK] = 2
                )
            ),
            "Group2",
            BLANK ()
        )
    )

    Result:

    Finally, build a Statement Column to show whether the Vehicle miss the deadline.

    Statement =
    IF (
        ISBLANK ( AlarmedResources[Group] ),
        BLANK (),
        IF (
            AlarmedResources[Group] = "Group1"
                && CALCULATE ( SUM ( AlarmedResources[MinDiff] ) ) <= 10,
            "In DeadLine",
            IF (
                AlarmedResources[Group] = "Group2"
                    && CALCULATE ( SUM ( AlarmedResources[MinDiff] ) ) <= 15,
                "In DeadLine",
                "Miss the DeadLine"
            )
        )
    )

    Result:

    You can download the pbix file from this link: Reporting FireDepartment Duration until arrived

     

    Best Regards,

    Rico Zhou

     

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