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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Cumulative Counts based on two date values

Hello everyone,

 

I am working on a project to convert a manual excel report into a Power Bi dashbaord to create a line chart for three categories on items ( Urgent/ Minor/Major).

 

The raw data look like this:

Work Item Id SeverityNew Week
42632 Minor1/15/2017
42633 Major1/15/2017
42634 Major1/15/2017
42669 Major1/15/2017
42670 Major1/15/2017
42746 Minor1/22/2017
42748 Minor1/22/2017
42772 Major1/22/2017

 

I want to have an intermediate table like:

 

Week start dateUrgent New Count
1/15/20170
1/22/20170
1/29/20171
2/5/20171
2/12/20176
2/19/20176

 

Here, 'Urgent New Count' ( similarly, 'Minor' and 'Major' item counts should be calculated) is calculated such that : If the Work Item is 'Urgent' and the 'New Week' column in the firsttable is less than the date mentioned in the second table, count it. The column ('Week start date') refers to the first date of every week ( Sunday is the first day of the week). This column's value will keep increasing every week as new dates get added to both the tables.

 

In excel, to calculate the 'Urgent New Count': COUNTIFS(Severity,"=*Urgent*",NewWeek, CONCATENATE("<",$B5))

was used. Here, the 'Severity' criteria referred to the first 'Severity' column of first table and the the second argument does the comparision.

 

This would create a running count of work items where the current count may/may not be higher that the previous cell's count if there are any new items 

 

Any help is really appreciated. 

 

Thanks in advance.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

Please pay attentation to ' '(Space) in your data. This is my PBIX file.

You can create your columns like this:

Urgent New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Urgent"
    )
)
Major New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Major"
    )
)
Minor New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Minor"
    )
)

Cumulative Counts based on two date values.PNG

 

Best Regards,

Icey

 

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

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

Please pay attentation to ' '(Space) in your data. This is my PBIX file.

You can create your columns like this:

Urgent New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Urgent"
    )
)
Major New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Major"
    )
)
Minor New Count =
CALCULATE (
    COUNTROWS ( 'Table 1' ) + 0,
    FILTER (
        'Table 1',
        'Table 1'[New Week] < EARLIER ( 'Table 2'[Date] )
            && ( 'Table 1'[Severity] ) = "Minor"
    )
)

Cumulative Counts based on two date values.PNG

 

Best Regards,

Icey

 

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

 

Anonymous
Not applicable

This is great. Thank you so much!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors