Forum Discussion
talkprem
2 years agoHelper I
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...
- 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 rowVAR 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_dateRETURNIF(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!
SamInogic
2 years agoSuper User
Hi talkprem ,
Just to confirm, do you changed the table name and column name as per your data structure. The issue shown in screenshot is due to mismatch of table name and column name.
talkprem
2 years agoHelper I
Yes I have modified it as per my data structure, Please help
- SamInogic2 years agoSuper User
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 rowVAR 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_dateRETURNIF(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!- talkprem2 years agoHelper I
The previous logic gave some aging increments but the 2nd one is giving 0 in my dataset.