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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Warren_FDA
Frequent Visitor

Only show rows that have certain criteria for a given day

I have a jobs table that shows all the positions in an office for every single day of the year.  I want to report the status of the positions on the last day of the month (in this case, 2/29/2024):

Sometimes a Position ID has two statuses on a given day.  Only one of them is the correct one to report out.Sometimes a Position ID has two statuses on a given day. Only one of them is the correct one to report out.

I have used a FILTER function to filter for only 2/28/2024 and office LNO.  For Positions GOLN10 and GOLN11, there are two statuses, based on the fields [Status] and [Sub-Status].  I need to report the name that matches with the correct Status/Sub-Status pair, based on the rank above.  The end result is a table where there is only one row per Position ID.

 

If any other information is needed, please let me know.  Many thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Warren_FDA ,

 

You can try formula like below:

result_ =
VAR string =
    SELECTCOLUMNS (
        'FindTable',
        "a",
            'FindTable'[Status] & " " & 'FindTable'[Sub-Status]
    )
RETURN
    IF (
        MAX ( 'Table'[Pos ID #] ) IN { "GOLN10", "GOLN11", "GOLN14" },
        CALCULATE (
            MAX ( 'Table'[Status] ),
            FILTER ( 'Table', MAX ( 'Table'[Sting_] ) IN string )
        ),
        MAX ( 'Table'[Status] )
    )
Sting_ = 'Table'[Status] & " " &'Table'[Sub-Status]

vkongfanfmsft_0-1711352214186.png

Best Regards,
Adamk Kong

 

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

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Warren_FDA ,

 

You can try formula like below:

result_ =
VAR string =
    SELECTCOLUMNS (
        'FindTable',
        "a",
            'FindTable'[Status] & " " & 'FindTable'[Sub-Status]
    )
RETURN
    IF (
        MAX ( 'Table'[Pos ID #] ) IN { "GOLN10", "GOLN11", "GOLN14" },
        CALCULATE (
            MAX ( 'Table'[Status] ),
            FILTER ( 'Table', MAX ( 'Table'[Sting_] ) IN string )
        ),
        MAX ( 'Table'[Status] )
    )
Sting_ = 'Table'[Status] & " " &'Table'[Sub-Status]

vkongfanfmsft_0-1711352214186.png

Best Regards,
Adamk Kong

 

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

 

 

Good morning  v-kongfanf-msft -

 

Your solution works!  Your concatenating of the [Status] and [Sub-Status] fields, along with using the MAX function not only solved this problem, but was the infrastructure needed for another task.  Thank you for your input and breaking the mental logjam.

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Thank you very much for the right direction, Ibendlin.  Question: should I delete this question and repost it anew with the tables I'm currently making?  Regards.

Please continue here.  Include a link to the usable sample data.

I am going to restate my question in brevity here:  I have a list of all the positions for an office on a certain day.  Each position is identified by a Position ID:

OfficePos ID #StatusSub-StatusNameDate
LNOGOLN1VacantDetail inROGERS, ROY2/29/2024
LNOGOLN10VacantEOD PendingGAYE, MARVIN2/29/2024
LNOGOLN10VacantTDYGAYE, MARVIN-12/29/2024
LNOGOLN11VacantDetail inDaCAT, FELIX2/29/2024
LNOGOLN11VacantVacant 2/29/2024
LNOGOLN12FilledAt PostGRIFFITH, NANCY2/29/2024
LNOGOLN13VacantVacant 2/29/2024
LNOGOLN14FilledDetail outBELLAMY, MATT2/29/2024
LNOGOLN14FilledDetail inWOLSTENHOLME, CHRIS2/29/2024
LNOGOLN15VacantVacant 2/29/2024
LNOGOLN16VacantVacant 2/29/2024
LNOGOLN17FilledAt PostMERRITT, STEPHIN2/29/2024

 

Notice that Position ID's GOLN10, GOLN11 and GOLN 14 have two rows each, each with a unique status/sub-status pair and a name of a person.  When there are two rows, only the row that has one of the following four pairs will be chosen.  It is guaranteed one of the following four pairs will be one of the rows:

StatusSub-Status
FilledAt Post
FilledDetail out
VacantEOD Pending
VacantVacant

 

I need to write the dax that will output the following table:

OfficePos ID #StatusSub-StatusNameDate
LNOGOLN1VacantDetail inROGERS, ROY2/29/2024
LNOGOLN10VacantEOD PendingGAYE, MARVIN2/29/2024
LNOGOLN11VacantVacant 2/29/2024
LNOGOLN12FilledAt PostGRIFFITH, NANCY2/29/2024
LNOGOLN13VacantVacant 2/29/2024
LNOGOLN14FilledDetail outBELLAMY, MATT2/29/2024
LNOGOLN15VacantVacant 2/29/2024
LNOGOLN16VacantVacant 2/29/2024
LNOGOLN17FilledAt PostMERRITT, STEPHIN2/29/2024

 

My apologies, but my company does not allow us to attach to external cloud storage, e.g., Dropbox.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors