Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Shifted Start Date with Year to Date Since Inception

Hi all, I'm new to Power BI and am trying to transform date data (sourced from SQL Server) according to the shift scheme we use. For propery reporting to my users, I need to determine which shift da...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous ,

    I share a sample measure formula to mark your shift date and index, you can try it if it works on your side:

    Shift Index =
    VAR _currDate =
        MAX ( Table[timestamp] )
    VAR _shiftIndex =
        IF ( HOUR ( _currDate ) >= 6 && HOUR ( _currDate ) <= 17, "1st", "2nd" )
    VAR _shitfDate =
        IF ( HOUR ( _currDate ) <= 3, _currDate - 1, _currDate )
    RETURN
        _shitfDate & " " & _shiftIndex
    

    I'm not so clarify for your condition #3, can you please explain more about this?
    In addition, if above not help, please provide some sample data to help us clarify your data structure and test to coding formula.

    Regards,

    Xiaoxin Sheng