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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
SandraGDS
New Member

CurrentIndex -1

Hi 
 
I need help, i want to say "if the ProcessNumber currentIndex -1 does'nt exist then -1 again untill found"
 
Timestamp =
VAR CurrentCase = 'Export Worksheet'[Order]
VAR CurrentIndex = 'Export Worksheet'[ProcessNumber]
VAR PreviousIndex = CurrentIndex - 1
RETURN
    CALCULATE (
        SELECTEDVALUE ( 'Export Worksheet'[DATE]),
        REMOVEFILTERS ( 'Export Worksheet'),
       'Export Worksheet'[Order] = CurrentCase,
        'Export Worksheet'[ProcessNumber] = PreviousIndex)
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @SandraGDS 

 

Please use this measure:

Timestamp =
VAR CurrentCase = 'Export Worksheet'[TRAY_NO]
VAR CurrentIndex = 'Export Worksheet'[STTN_NO_R]
VAR PreviousIndex =
    CALCULATE (
        MAX ( 'Export Worksheet'[STTN_NO_R] ),
        REMOVEFILTERS ( 'Export Worksheet' ),
        'Export Worksheet'[TRAY_NO] = CurrentCase,
        'Export Worksheet'[STTN_NO_R] < CurrentIndex
    )
RETURN
    CALCULATE (
        SELECTEDVALUE ( 'Export Worksheet'[AMD_DATE] ),
        REMOVEFILTERS ( 'Export Worksheet' ),
        'Export Worksheet'[TRAY_NO] = CurrentCase,
        'Export Worksheet'[STTN_NO_R] = PreviousIndex
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @SandraGDS 

 

Please use this measure:

Timestamp =
VAR CurrentCase = 'Export Worksheet'[TRAY_NO]
VAR CurrentIndex = 'Export Worksheet'[STTN_NO_R]
VAR PreviousIndex =
    CALCULATE (
        MAX ( 'Export Worksheet'[STTN_NO_R] ),
        REMOVEFILTERS ( 'Export Worksheet' ),
        'Export Worksheet'[TRAY_NO] = CurrentCase,
        'Export Worksheet'[STTN_NO_R] < CurrentIndex
    )
RETURN
    CALCULATE (
        SELECTEDVALUE ( 'Export Worksheet'[AMD_DATE] ),
        REMOVEFILTERS ( 'Export Worksheet' ),
        'Export Worksheet'[TRAY_NO] = CurrentCase,
        'Export Worksheet'[STTN_NO_R] = PreviousIndex
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

SandraGDS
New Member

SandraGDS_0-1685023037171.png

 

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.

Top Solution Authors
Top Kudoed Authors