I have a function that will look at a null field in column "Project Commit Cap" and lookup the value with the same ID and the next earlier date and give column "Project Commit Cap NoNulls" that value. DAX does not do it recursively so if there are 2 null values in a row I get a blank. In another language, a simple while loop (while value is null do: XYZ
) would solve this, but DAX does not support For/While loops?
How can I get the working DAX function to apply the filled in values and keep running until there are no more nulls?
Optionally how can I brute force it to run X number of times (maybe 10)? it wouldn't be a pretty solution but will get the job done
Example table below is filtered to show only one 2 IDs, records of different IDs are between the records shown here so I cant do an excel-like function "take value from the row below"
Here is the DAX function that will fill in the previous value (as shown in the pic above):
ProjectCommitCap_NoNulls =
IF (
ISBLANK ( 'Project Story Data'[Projected Commitments Cap] ),
LOOKUPVALUE (
'Project Story Data'[Projected Commitments Cap],
'Project Story Data'[ID], 'Project Story Data'[ID],
'Project Story Data'[Date of Data], CALCULATE (
MAX ( 'Project Story Data'[Date of Data] ),
FILTER (
'Project Story Data',
'Project Story Data'[ID] = EARLIER ( 'Project Story Data'[ID] )
&& 'Project Story Data'[Date of Data]
< EARLIER ( 'Project Story Data'[Date of Data] )
)
)
),
'Project Story Data'[Projected Commitments Cap]
)
I need to look like this (all values in NoNulls to be filled in):