Forum Discussion
Anonymous
5 years agoNot applicable
Firstnonblank rows based on another column per group
Hi everyone, I have a situation where I need to move the value of a row to the firstnonblank row based on another column per group. In my example below, I would love to move the value of "iscom...
- 5 years ago
Anonymous,
Try these measures:
iscomplained calc = VAR vCurrentStatus = MAX ( Table2[status] ) VAR vValueBlankStatus = CALCULATE ( MAX ( Table2[iscomplained] ), ALLSELECTED ( Table2 ), VALUES ( Table2[customerno] ), Table2[status] = BLANK () ) VAR vMinStatusDate = CALCULATE ( MIN ( Table2[status date] ), ALLSELECTED ( Table2 ), VALUES ( Table2[customerno] ), NOT Table2[status] = BLANK () ) VAR vMinStatus = CALCULATE ( MIN ( Table2[status] ), ALLSELECTED ( Table2 ), VALUES ( Table2[customerno] ), Table2[status date] = vMinStatusDate ) VAR vResult = SWITCH ( TRUE (), ISBLANK ( vCurrentStatus ), BLANK (), IF ( NOT ISBLANK ( vValueBlankStatus ) && vCurrentStatus = vMinStatus, vValueBlankStatus, MAX ( Table2[iscomplained] ) ) ) RETURN vResult iscomplained final = SUMX ( VALUES ( Table2[customerno] ), [iscomplained calc] )
DataInsights
5 years agoSuper User
Anonymous,
Try these measures:
iscomplained calc =
VAR vCurrentStatus =
MAX ( Table2[status] )
VAR vValueBlankStatus =
CALCULATE (
MAX ( Table2[iscomplained] ),
ALLSELECTED ( Table2 ),
VALUES ( Table2[customerno] ),
Table2[status] = BLANK ()
)
VAR vMinStatusDate =
CALCULATE (
MIN ( Table2[status date] ),
ALLSELECTED ( Table2 ),
VALUES ( Table2[customerno] ),
NOT Table2[status] = BLANK ()
)
VAR vMinStatus =
CALCULATE (
MIN ( Table2[status] ),
ALLSELECTED ( Table2 ),
VALUES ( Table2[customerno] ),
Table2[status date] = vMinStatusDate
)
VAR vResult =
SWITCH (
TRUE (),
ISBLANK ( vCurrentStatus ), BLANK (),
IF (
NOT ISBLANK ( vValueBlankStatus )
&& vCurrentStatus = vMinStatus,
vValueBlankStatus,
MAX ( Table2[iscomplained] )
)
)
RETURN
vResult
iscomplained final =
SUMX ( VALUES ( Table2[customerno] ), [iscomplained calc] )
Anonymous
5 years agoNot applicable
This worked, Thanks alot 🙂