cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors