Forum Discussion
Stacked Bar Graph from time duration column
- 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 visualResult:BeforeAfterand here is sample pbix file, please try it.Regards,Lin
Hi, mazzurri
without knowing your data, I can only do an estimated guess on what may solve your problem:
create a new calculated like this:
column =
IF (
table[start time] >= TIME ( 0, 0, 0 )
&& table[start time] <= TIME ( 11, 59, 0 ),
"Day shift",
"Night shift"
)
It seems like you are quite new here in the forum, welcome. Here is a link to a post with a lot of tips for how to getting high quality answers when you post in this forum: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Thank you! That helps in getting a "shift" filter on my plot, but how would I plot them both on the same bar/line graph? I would like 2 lines (1 for day and 1 for night) and a stacked bar graph for duration (day and night stacked on each other).
- v-lili6-msft6 years agoCommunity Support
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 visualResult:BeforeAfterand here is sample pbix file, please try it.Regards,Lin- mazzurri6 years agoRegular Visitor
Thank you so much! That worked perfectly!
Mario