Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Counting Net New and Net Loss

Every week I receive a report on the current expired payments.  If the payment showed up in 2/2/2022 and 2/9/2022 you know it remained expired, however if it doesnt show up in the 2/16/22 file you know that it was solved/processed so I would count that as 1 processed payment. 

 

In the below example payment abc and def were processed because they stopped appearing, xyz is still unprocessed so the total number of processed payments is 2.

 

Is there a measure or conditional column I can create to do this counting (comparing this week to last week) to see how many were closed or how many new expired payments appeared?

 

 

 

File DateUnique Payment IDPrimary Key (Merged Column)
2 16 2022xyz2 16 2022xyz
2 9 2022xyz2 9 2022xyz
2 2 2022xyz2 2 2022xyz
2 9 2022abc2 9 2022abc
2 2 2022abc2 2 2022abc
2 2 2022def2 2 2022def

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Check the formulas.

    this_week = 
    var _thisweek = WEEKNUM(TODAY())
    var thisweek_ids = CALCULATETABLE(VALUES('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[File Date])=_thisweek))
    return
    CALCULATE(DISTINCTCOUNT('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),NOT('Table'[Unique Payment ID] in thisweek_ids)))
    
    last_week = 
    var _thisweek = WEEKNUM(TODAY())
    var thisweek_ids = CALCULATETABLE(VALUES('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[File Date])=_thisweek-1))
    return
    CALCULATE(DISTINCTCOUNT('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),NOT('Table'[Unique Payment ID] in thisweek_ids)))

     

     

    Best Regards,

    Jay

4 Replies

  • Hi Anonymous, does this work?:

    Unprocessed = 
    VAR MaxDate = CALCULATE(MAX('Table'[File Date]), ALL('Table'))
    VAR Unprocessed = CALCULATE(
    DISTINCTCOUNT('Table'[Unique Payment ID])
    , 'Table'[File Date] = MaxDate
    )
    RETURN
    IF(ISBLANK(Unprocessed), 0, Unprocessed)

    Processed =
    DISTINCTCOUNT('Table'[Unique Payment ID]) - [Unprocessed]
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Check the formulas.

    this_week = 
    var _thisweek = WEEKNUM(TODAY())
    var thisweek_ids = CALCULATETABLE(VALUES('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[File Date])=_thisweek))
    return
    CALCULATE(DISTINCTCOUNT('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),NOT('Table'[Unique Payment ID] in thisweek_ids)))
    
    last_week = 
    var _thisweek = WEEKNUM(TODAY())
    var thisweek_ids = CALCULATETABLE(VALUES('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[File Date])=_thisweek-1))
    return
    CALCULATE(DISTINCTCOUNT('Table'[Unique Payment ID]),FILTER(ALLSELECTED('Table'),NOT('Table'[Unique Payment ID] in thisweek_ids)))

     

     

    Best Regards,

    Jay