Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
c8linoneil
New Member

Using the stacked bar chart to win loss streaks over time

Hi all,

 

I am trying to create a visual like this in Power BI Desktop. This visual will, hopefully, measure the win/loss streak of a specific team over time.

a9b588aa-01ef-4327-bcca-597f7cee3779.jpg

For example, if we were look at the year, january would be at the bottom of the y-axis and decemeber at the top with the stacks representing how many days the team had a win streak, loss streak, etc.

 

I do not want something where it counts the total days won and lost for each team (two sections per bar). I'm hoping to find a solution that will represent how long each streak has been throughout the year.

 

To do that I know I need a table similar to this one. 

c8linoneil_0-1713290049783.png

 

The data I am using contains an ID (think team name) and the dates that they have won (1) and lost (0). I have a measure that calculates the total days they have won, total days they have lost, and total days overall.

 

How should I go about calculating the # of streak days, associating that number with a specific streak (streak 1, 2, 3, etc.), and assigning win or loss? 

 

Any and all help would be appreciated 🙂

2 REPLIES 2
c8linoneil
New Member

Hi @v-jingzhan-msft 

 

The first table is a sample of the current data I have. The dates for each team go on for longer in the actual data. The last column represents win(1) and loss(0).

IDTeam NameDateResult
1Lions1/1/20241
1Lions1/2/20240
1Lions1/3/20240
1Lions1/4/20241
1Lions1/5/20241
2Tigers1/1/20240
2Tigers1/2/20241
2Tigers1/3/20240
2Tigers1/4/20241
2Tigers1/5/20241
3Bears1/1/20241
3Bears1/2/20241
3Bears1/3/20240
3Bears1/4/20240
3Bears1/5/20240

 

The second table reflects how I would like to transform that data. I view Streak ID as an index. This column is necessary to create the stacked bar visual.

IDStreak IDStreak # of DaysType of Streak
1Streak 111
1

Streak 2

2

0

1Streak 321
2Streak 410
2Streak 511
2Streak 610
2Streak 721
3Streak 821
3Streak 930

 

Hopefully this can give a little more insight!

v-jingzhan-msft
Community Support
Community Support

Hi @c8linoneil 

 

Can you share some dummy data including the Team ID and the dates that they have won (1) and lost (0)? And Can you describe the logic to calculate the # of streak days? To achieve your goal, it seems we need to calculate the # of streak days in each month for every team. Currently I don't understand how the # of streak days is calculated and what "Streak ID" means? Can you provide some more information about this?

 

Best Regards,
Jing

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.