Forum Discussion

Sri_phani's avatar
Sri_phani
Helper III
2 years ago
Solved

Get the First activity based on date column

Hi,    I have been trying this for a long time, but I haven't been able to do this.  please help me with this.    Requirement: I have to show agents today's first break period in a Card visual.  ...
  • Greg_Deckler's avatar
    2 years ago

    Sri_phani Try this. PBIX is attached below signature.

    Measure = 
        VAR __Emp = MAX('Table'[Employee Name as per IROZ])
        VAR __Table = FILTER( 'Table', [Extracted Activity Name] = "Break_Unpaid" )
        VAR __MaxBreakStart = MAXX( __Table, [Activity start IST/EET] )
        VAR __MaxBreakEnd = MAXX( FILTER( 'Table', [Activity start IST/EET] = __MaxBreakStart ), [Activity end IST/EET] )
        VAR __BreakStartTime = __MaxBreakStart - TRUNC( __MaxBreakStart )
        VAR __BreakEndTime = __MaxBreakEnd - TRUNC( __MaxBreakEnd )
        VAR __Result = FORMAT(__BreakStartTime, "Medium time" ) & " - " & FORMAT( __MaxBreakEnd, "Medium time" )
    RETURN
        __Result

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    hi Sri_phani ,

     

    as per the data available in the mentioned link the minimum time for break on 26th Jul should be 12.45 PM.

    After considering this, if I proceed then I have done the following steps

    Filter the table with respect to Break_Unpaid

    Calculating first break

     

    Please check visualization

    Now if you need the yellow/red highlighted time as first break then either max function or distinctcount function (if there are more than 2 break periods available for an employee per day) needs to be used.
    Using max function

    Using Distinctcount function

    Visualization can be done in the similar way.

    If this solves your problem then accept the same as your solution.