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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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 Kudoed Authors