Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Selecting Earliest Working Date from Date Table Based on Shipping Time

Hi, I have a date table which is a calculated table and contains a column "Is Working Day" with values 0 or 1. The business problem I am trying to solve is that I have an Order Date (which will alway...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    5 years ago

    Hi,  Anonymous 

     

    Sorry, I thought what you need is the same result, so I made a wrong change in the measure. Just need to modify the measure, the correct result should be like this:

    Column =
    VAR a =
        ADDCOLUMNS (
            'Dim Date Table',
            "aa",
                RANKX (
                    FILTER (
                        ALL ( 'Dim Date Table' ),
                        [Is Working Day] = 1
                            && [Date] >= Orders[Order Date]
                    ),
                    [Date],
                    ,
                    ASC
                )
        )
    RETURN
        MAXX ( FILTER ( a, [aa] = [Processing Time] ), [Date])

    Best Regards

    Janey Guo

     

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