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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Use latest record in bar chart

Hello,

 

I'd like to visualize data from Microsoft DevOps with Power BI.

Therefore I want to create a bar chart that shows the number of User Stories in their current state.

 

My dataset (simplified) looks like this:

 

Date  WorkitemId    Revision    State
2020-05-01  14146  1New
2020-05-02  14146  2Active
2020-05-03  14146  3Closed
2020-05-01  15537  1New
2020-05-02  15537  2Active

 

I created the following measure to get the latest state:

LastState =
CALCULATE (
MAX ( viewWorkItems[State] ),
FILTER ( viewWorkItems, viewWorkItems[Rev] = MAX ( viewWorkItems[Rev] ) )
)
Using this measure in a table works like a charm. The following table shows the latest/current state for each User Story (WorkItemId):

measure.PNG

 

Now I'd like to create a bar chart that counts the number of User Stories at their latest/current state.

The bar chart should look like this:

barchart.PNG

 

Apparently I can't use my created measure within the bar chart. Therefore all I get is currently a bar chart that looks like this:

barchart2.PNG

 

Which is the best approach to solve this problem?

 

Thanks in advance

 

 

 

 

 
 
 
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

You need to add [workitemid] in axis, which should work correctly. In addition, your measure is used to calculate [state] instead of calculate count, so it can't put in Value field. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi @Anonymous , 

You need to add [workitemid] in axis, which should work correctly. In addition, your measure is used to calculate [state] instead of calculate count, so it can't put in Value field. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thanks @dax, that helped!

 

But what if I have >1000 WorkItems and can't use WorkItemId in axis or legend because I just want to show the count of WorkItemId's at the current state.

az38
Community Champion
Community Champion

Hi @Anonymous 

as I understand, you can easily filter by desired Status in Filters Pane. 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.