Forum Discussion

talkprem's avatar
talkprem
Helper I
2 years ago
Solved

Missing Entry Days Count Calculated Column in DAX

Hi, I need a Ageing calculated column when the entry row is blank. if row is blank of entry date side then give number of missing days as I am trying to show row which don’t have data only column...
  • SamInogic's avatar
    SamInogic
    2 years ago

    Hi talkprem ,

    We have used below DAX expression and getting the aging column as 0,1,2 based on the number of days difference from Entry date.

     

    Ageing =
    VAR CurrentDate = Agingtable[Calendar date ]
    VAR EntryDate = Agingtable[entry_date  ]

    // Calculate the last non-blank entry_date before the current row
    VAR LastEntryDate =
        CALCULATE(
            MAX(Agingtable[entry_date  ]),
            FILTER(
                ALL(Agingtable),
                Agingtable[Calendar date ] <= CurrentDate
                    && NOT(ISBLANK(Agingtable[entry_date  ]))
            )
        )

    // Calculate the Ageing based on the difference between current date and last non-blank entry_date
    RETURN
        IF(
            ISBLANK(EntryDate),
            IF(
                NOT(ISBLANK(LastEntryDate)),
                DATEDIFF(LastEntryDate, CurrentDate, DAY),
                BLANK()
            ),
            0
        )

    Please note to make sure you are also considering entry date in column expression, as per your screenshot it is some difference date field.

    Result using expression is as follows,


    Let us know if we are missing anything in the requirement.

    Thanks!