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
Anonymous
Not applicable

A measure to count items closed in custom date ranges

Hi all!

I have three tables :
Calendar

Date
01/01/2021
02/01/2021
20/01/2022

and so on


Iterations

StartDateEndDateIterationName
09/12/2021 22/12/2021         23.6
23/12/2021 12/01/2022         23.7
13/01/2022 02/02/2022         24.1


WorkItems

WorkItemIDStatusClosedDate
xxx1Closed 01/01/2022
xxx2  23/12/2021
xxx3Open 
xxx4Closed 

 


The objective here is to count all work items closed (status closed and have a closed date) during each of the Iterations. I want to build a visual, where the Iterations are on the X Axis and they have a number of items closed during each of them.
Kind of like this:
visual.jpg

What should the measure to calculate this look like? How to make sure the IterationName field displays in a chronological order on the visual? Calendar Table is related to WorkItems on Date-ClosedDate. I don't know how to build relationship between Iterations and WorkItems. Or should it be related to Calendar?

WorkItems table isn't perfect and there are some missing fields.

 

Please help.

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

Hi @Anonymous ,

 

You do not need to build relationship between Iterations and WorkItems. To make sure the IterationName field order on the visual, you need to sort IterationName by StartDate(or EndDate) column.

 

vkkfmsft_0-1642991451503.png

 

Then create the measure, and set the type of the X-axis to "Categorical".

 

Measure = 
CALCULATE ( 
    DISTINCTCOUNT ( WorkItems[WorkItemID] ),
    FILTER (
        WorkItems,
        WorkItems[ClosedDate] <= MAX ( Iterations[EndDate] )
            && WorkItems[ClosedDate] >= MAX ( Iterations[StartDate] )
            && WorkItems[Status] = "Closed"
    )
)

vkkfmsft_1-1642991702289.png

vkkfmsft_2-1642991862014.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

You do not need to build relationship between Iterations and WorkItems. To make sure the IterationName field order on the visual, you need to sort IterationName by StartDate(or EndDate) column.

 

vkkfmsft_0-1642991451503.png

 

Then create the measure, and set the type of the X-axis to "Categorical".

 

Measure = 
CALCULATE ( 
    DISTINCTCOUNT ( WorkItems[WorkItemID] ),
    FILTER (
        WorkItems,
        WorkItems[ClosedDate] <= MAX ( Iterations[EndDate] )
            && WorkItems[ClosedDate] >= MAX ( Iterations[StartDate] )
            && WorkItems[Status] = "Closed"
    )
)

vkkfmsft_1-1642991702289.png

vkkfmsft_2-1642991862014.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.