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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AragakiSora
Frequent Visitor

Create a cumulative count based on criteria

Hello! 

 

I have a table similar to this:

NameIDLast Update 
Michelle 7/2/2023
Michelle10000127/5/2023
Michelle10000128/29/2023
Glory10000147/2/2023
Glory 7/4/2023
Glory 8/13/2023
Glory10000148/18/2023
Glory10000148/29/2023
Nick10001017/20/2023
Nick10001018/10/2023
Nick10001018/13/2023
Nick10001018/18/2023
Nick 8/29/2023
John10001047/3/2023
John10001048/5/2023
John 8/29/2023

 

I am trying to create a cumulative count of missing IDs, but the hard part is that the cumulative count only considers the cases that have not been solved. For example, Michelle's ID was missing on July 2nd but the issue was resolved on the 5th, so the cumulative count should ignore Michelle's case. Glory's ID was missing on July 4th and August 13th, but the issue was resolved on the 18th, so Glory's case would not be included in the cumulative count. 

 

I am also wondering whether it is possible to create a calculated column that marks all the unresolved missing ID cases or cases that haven't been resolved a week after their first appearances so that I can put those cases into a table.

 

Thank you in advance!

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

Hi @AragakiSora ,

Please check that this calculated column meets your requirements:

Flag = 
VAR CurrentName = 'Table'[Name]
VAR CurrentDate = 'Table'[Last Update]
VAR CurrentID = 'Table'[ID]
VAR MinDateWithID = 
    CALCULATE(
        MIN('Table'[Last Update]),
        FILTER(
            'Table',
            'Table'[Name] = CurrentName &&
            NOT(ISBLANK('Table'[ID])) &&
            'Table'[Last Update] <= CurrentDate
        )
    )
RETURN
    IF(
        ISBLANK(CurrentID) && MinDateWithID > DATEADD('Table'[Last Update], -7, DAY),
        1,
        0
    )

vcgaomsft_0-1693460687170.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @AragakiSora ,

Please check that this calculated column meets your requirements:

Flag = 
VAR CurrentName = 'Table'[Name]
VAR CurrentDate = 'Table'[Last Update]
VAR CurrentID = 'Table'[ID]
VAR MinDateWithID = 
    CALCULATE(
        MIN('Table'[Last Update]),
        FILTER(
            'Table',
            'Table'[Name] = CurrentName &&
            NOT(ISBLANK('Table'[ID])) &&
            'Table'[Last Update] <= CurrentDate
        )
    )
RETURN
    IF(
        ISBLANK(CurrentID) && MinDateWithID > DATEADD('Table'[Last Update], -7, DAY),
        1,
        0
    )

vcgaomsft_0-1693460687170.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Ashish_Mathur
Super User
Super User

Hi,

Clearly show the exact result you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@AragakiSora , with help from date table, create measure like

 

M1 = calculate(countrows(filter(Table, isblank(Table[ID]))),filter(all('Date'),'Date'[date] <=max('Date'[date])))


M2 = calculate(countrows(Table),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

Blank only count = Countx(values(Table[Name]), if([M1] = [M2], [Name], Blank()))

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

 

Running Total/ Cumulative:
https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=42

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.