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
Robert4049
Frequent Visitor

RankX Weird Behavior With Filter

Okay talked about confused, I went ahead and removed blank arrive date times but the still show up when I filter and I can't figure this out. Any hints?

 

 

MedicalUnitFirstDue = 
VAR CurrentExposureID = Apparatus[Run Number]
VAR EngineTypeID = {"11", "12", "76"}
RETURN
    IF (
        Apparatus[Apparatus Type ID] IN EngineTypeID,
        RANKX (
            FILTER (
                Apparatus,
                Apparatus[Run Number] = CurrentExposureID
                    && ISBLANK(Apparatus[Arrival Date/Time]) == FALSE()
                    && Apparatus[Apparatus Type ID] IN EngineTypeID
            ),
            Apparatus[Arrival Date/Time],
            ,
            DESC,
            DENSE
        ),
        BLANK ()
    )

 

Robert4049_0-1629409919748.png

 

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi  @Robert4049 ,

 

Could you pls share your .pbix file for test?

Remember to remove the confidentail information.

 

Best Regards,
Kelly

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

Hey Kelly,

I rewrote the column as 

    IF (
        Apparatus[Arrival Date/Time] <> BLANK() 
        && Apparatus[Apparatus Type ID] IN EngineTypeID,
        IF (
            RANKX (
                FILTER (
                    Apparatus,
                    Apparatus[Run Number]
                        == CurrentExposureID && Apparatus[Apparatus Type ID] IN EngineTypeID
                ),
                Apparatus[Arrival Date/Time],
                Apparatus[Arrival Date/Time],
                ASC,
                Skip
            ) = 1,
            TRUE (),
            FALSE ()
        ),
        FALSE ()
    )


Unfortunately there's no good way to redact the confidential data. 

Hi @sevenhills ,

 

Without actual data,it would be a little tough to find a solution.

Try below expression:

measure =
IF (
    RANKX (
        FILTER (
            Apparatus,
            Apparatus[Run Number]
                == CurrentExposureID
                    && Apparatus[Apparatus Type ID]
                        IN EngineTypeID
                            && pparatus[Arrival Date/Time] <> BLANK ()
                            && Apparatus[Apparatus Type ID] IN EngineTypeID
        ),
        Apparatus[Arrival Date/Time],
        Apparatus[Arrival Date/Time],
        ASC,
        SKIP
    ) = 1,
    TRUE (),
    FALSE ()
)

 

Best Regards,
Kelly

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

sevenhills
Super User
Super User

&& Apparatus[Arrival Date/Time] <> BLANK ()

Try this ...

I will ask you to try one more attempt, (as it is tough without sample data and expected output data, for someone to provide DAX)

 

Let us see this is what you need as first due date time for every run number. Once we get this one resolved, then you can build the rank similarly. 

 

Below DAX, gives the first Arrival Date time for the Run number. 

I used your filter of type id, and non blank arrival date time rows

 

 

MedicalUnitFirstDue = 
VAR CurrentExposureID = Apparatus[Run Number]
VAR EngineTypeID = {"11", "12", "76"}
Var _c = CALCULATE(
            Min(Apparatus[Arrival Date/Time]),
            filter(
               allexcept(Apparatus, Apparatus[Run Number], Apparatus[Apparatus Type ID], Apparatus[Arrival Date/Time]),

Apparatus[Run Number] = CurrentExposureID
                    && Apparatus[Arrival Date/Time] <> BLANK()
                    && Apparatus[Apparatus Type ID] IN EngineTypeID
            )
 )

RETURN # _c
    IF (NOT IsBlank(_c), _c, BLANK ())

 

 

... not the full solution with Rankx, but trying to see the min date is working right.  

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.

Top Solution Authors