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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.