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
Anonymous
Not applicable

"Overall Site Status" based off multiple rows of data

Hi There, 

I'm trying to create a formula (with no luck so far) to create an "Overall Site Status". 

 

First, here is an example of how my data is formatted: 

 

Site ID Status
123

Open

123Resubmitted
123Resubmitted
456

Open

456Open
456Resubmitted
789Closed
789Closed
789Closed
111Open
111Resubmitted

 

Basically, this is an "issues" table. There can be multiple issues for each site.

An issue can only be closed if ALL issues are closed, however there can be some sites that have a mixure of Open and Resubmitted. 

 

The "overall" status of the site however, is that if there is even one row per site that is marked as "Open" (rather than resubmitted) then the overall site status needs to be "Open". If all rows are "Resubmitted" then the site can be marked as "resubmitted". 

 

Can someone please help with a formula? Struggling on this one!

Example of expected outcome: 

Site ID StatusOverall Site Status
123

Open

Open

123ResubmittedOpen
123ResubmittedOpen
456

Open

Open

456OpenOpen
456ResubmittedOpen
789ClosedClosed
789ClosedClosed
789ClosedClosed
111OpenOpen
111ResubmittedOpen
222ResubmittedResubmitted
222ResubmittedResubmitted
222ResubmittedResubmitted
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Try this calculated column. I chose a calculated column (instead of a measure) so you can use this column in a slicer.

 

Overall Site Status =
VAR vCountAll =
    CALCULATE ( COUNTROWS ( Table1 ), ALLEXCEPT ( Table1, Table1[Site ID ] ) )
VAR vCountResubmitted =
    CALCULATE (
        COUNTROWS ( Table1 ),
        ALLEXCEPT ( Table1, Table1[Site ID ] ),
        Table1[Status] = "Resubmitted"
    )
VAR vCountClosed =
    CALCULATE (
        COUNTROWS ( Table1 ),
        ALLEXCEPT ( Table1, Table1[Site ID ] ),
        Table1[Status] = "Closed"
    )
VAR vResult =
    SWITCH (
        TRUE (),
        vCountAll = vCountClosed, "Closed",
        vCountAll = vCountResubmitted, "Resubmitted",
        "Open"
    )
RETURN
    vResult

 

DataInsights_0-1646923812469.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@Anonymous,

 

Try this calculated column. I chose a calculated column (instead of a measure) so you can use this column in a slicer.

 

Overall Site Status =
VAR vCountAll =
    CALCULATE ( COUNTROWS ( Table1 ), ALLEXCEPT ( Table1, Table1[Site ID ] ) )
VAR vCountResubmitted =
    CALCULATE (
        COUNTROWS ( Table1 ),
        ALLEXCEPT ( Table1, Table1[Site ID ] ),
        Table1[Status] = "Resubmitted"
    )
VAR vCountClosed =
    CALCULATE (
        COUNTROWS ( Table1 ),
        ALLEXCEPT ( Table1, Table1[Site ID ] ),
        Table1[Status] = "Closed"
    )
VAR vResult =
    SWITCH (
        TRUE (),
        vCountAll = vCountClosed, "Closed",
        vCountAll = vCountResubmitted, "Resubmitted",
        "Open"
    )
RETURN
    vResult

 

DataInsights_0-1646923812469.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Fantastic, thank you! That worked!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.