Forum Discussion

mazzurri's avatar
mazzurri
Regular Visitor
6 years ago
Solved

Stacked Bar Graph from time duration column

I am currently capturing my team's  daily activity. I have a query for time duration of each activity (end time - start time). Right now I am plotting total duration (00:00 - 23:59). I would like to ...
  • v-lili6-msft's avatar
    v-lili6-msft
    6 years ago

    hi mazzurri 

    For your case, you could try this way:

    Create two day /night measure for Duration and  two day /night measure for Ticket Count

    For example:

    DAY shift Duration = CALCULATE(SUM('Table 1'[Duration]),FILTER('Table 1','Table 1'[SHIFTCOLUMN]="DAY shift" ))
    Night shift Duration = CALCULATE(SUM('Table 1'[Duration]),FILTER('Table 1','Table 1'[SHIFTCOLUMN]="Night shift" ))
     
    Day shift Ticket Count = CALCULATE(SUM('Table 1'[Ticket Count]),FILTER('Table 1','Table 1'[SHIFTCOLUMN]="Day shift" ))
    Night shift Ticket Count = CALCULATE(SUM('Table 1'[Ticket Count]),FILTER('Table 1','Table 1'[SHIFTCOLUMN]="Night shift" ))
     
    Then put these measrue into visual
    Result:
    BeforeAfter
     
    and here is sample pbix file, please try it.
     
    Regards,
    Lin