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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_n_MarianLein
Helper II
Helper II

Show opened vs closed tasks per week

Hi all,

I'm working on some ticket reporting and want to plot a graph that shows tickets that have been opened or closed per week.

 

My raw data is this:

Ticket IDOpened weekClosed week
1230012020-CW12020-CW3
1230022020-CW22020-CW2
1230032020-CW22020-CW3

 

I would like my bar chart to have the weeks on the X axis, and per week have two bars showing the count of opened and closed tickets.

I can do that in two separate charts, but how can I combine the two?

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @_n_MarianLein

 

There're  2 ways:

1.Go to "edit queries">select"open week" and "close week">"unpivot columns":

 

Annotation 2020-02-25 154753.pngAnnotation 2020-02-25 154855.png

 

Back to the report view, and put the columns in the clustered bar chart visual:

 

Annotation 2020-02-25 155057.png

 

2.Another way is to create a dimweek table using a dax expression as below:

 

Dim week = DISTINCT(UNION(VALUES('Table'[Opened week]),VALUES('Table'[Closed week])))

 

Annotation 2020-02-25 155249.png

 

Then create 2 measures:

 

Opened tickets = CALCULATE(COUNTA('Table'[Ticket ID]),USERELATIONSHIP('Dim week'[week],'Table'[Opened week]))
Closed tickets = CALCULATE(COUNTA('Table'[Ticket ID]),USERELATIONSHIP('Dim week'[week],'Table'[Closed week]))

 

Finally,put the dimweek and measures  in the clustered bar chart visual:

Annotation 2020-02-25 155549.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

 

Did I answer your question? Mark my post as a solution!

 

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @_n_MarianLein

 

There're  2 ways:

1.Go to "edit queries">select"open week" and "close week">"unpivot columns":

 

Annotation 2020-02-25 154753.pngAnnotation 2020-02-25 154855.png

 

Back to the report view, and put the columns in the clustered bar chart visual:

 

Annotation 2020-02-25 155057.png

 

2.Another way is to create a dimweek table using a dax expression as below:

 

Dim week = DISTINCT(UNION(VALUES('Table'[Opened week]),VALUES('Table'[Closed week])))

 

Annotation 2020-02-25 155249.png

 

Then create 2 measures:

 

Opened tickets = CALCULATE(COUNTA('Table'[Ticket ID]),USERELATIONSHIP('Dim week'[week],'Table'[Opened week]))
Closed tickets = CALCULATE(COUNTA('Table'[Ticket ID]),USERELATIONSHIP('Dim week'[week],'Table'[Closed week]))

 

Finally,put the dimweek and measures  in the clustered bar chart visual:

Annotation 2020-02-25 155549.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

 

Did I answer your question? Mark my post as a solution!

 

 

 
Tad17
Solution Sage
Solution Sage

Hey @_n_MarianLein 

 

@bfernandez Is awesome and very thurough. If you want to simplify it a little you can create a week table with you CW1, CW2 and then use that as your "date" table and create a helper column for both close and open (=Right(opened/Closed week, 3)). You could even create the week table by referencing the original query and then deleting the other columns. All this does different from @bfernandez post is it allows you to show CW1 etc in the Axis instead of a date and it saves your from having to create a relational column in the original data with the week start date.

 

Then you can create a clustered column chart and drag your week table column to the Axis field and your opened week and closed week as your values. 

 

@bfernandez solution is the better route to go, but this is kind of cheating and may be more in line with what you want the end result to look like.

 

I recommend @bfernandez as a solution (and for kudos), but you are welcome to kudo here and accept it as a second solution lol. Let us know if this helps.

bfernandez
Resolver II
Resolver II

Hi @_n_MarianLein 

 

This can get a little bit tricky but I have come across this same issue before.

 

One thing I would suggest is before moving forward, get the actual week start date.

I am assuming Opened week and closed week is based off of a date field?

If so, in the PowerQuery, extract the Start of Week in the Transform tab.

 

From there, you will need to create a Calendar table to connect the dates.

 https://kohera.be/blog/power-bi/how-to-create-a-date-table-in-power-bi-in-2-simple-steps/

 

Then by creating measures that sum the ticket counts, you can use the USERELATIONSHIP DAX function to seperate these values accordingly.

 

Tickets_Closed = CALCULATE(COUNT([column][Date Closed]),USERELATIONSHIP('Calendar'[Date],[column][Date Closed]))

Tickets_Entered = COUNT([column][Date Entered])
 
Then make the connections in the data model:
 
Date Closed.pngDate Entered.png
 
Finally, you should expect something that looks similar to this:
 
Variance.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.