Forum Discussion
Anonymous
3 years agoNot applicable
Solving calcuated Column problem using dax
I am facing an issue with calculated column. This is sample data and here I want to achieve if isStoreClosed is Closed Status then I want to divide the Daily_Split Value by 6 and add this aver...
- 3 years ago
hi Anonymous
It would be good if you could simplify your case and provide the value of your expected column directly.
- 3 years ago
hi Anonymous
try to add a column like:
Column2 = VAR _lastclosedsplit = MAXX( TOPN( 1, FILTER( TableName, TableName[Date]<EARLIER(TableName[Date]) &&TableName[IsClosed]="Closed" ), TableName[Date] ), TableName[DailySplit] ) RETURN IF( [IsClosed] = "Closed", BLANK(), [DailySplit] + DIVIDE(_lastclosedsplit, 6 ) )or
Column = VAR _lastcloseddate = MAXX( FILTER( TableName, TableName[Date]<EARLIER(TableName[Date]) &&TableName[IsClosed]="Closed" ), TableName[Date] ) VAR _lastclosedsplit = MAXX( FILTER( TableName, TableName[Date]=_lastcloseddate ), TableName[DailySplit] ) RETURN IF( [IsClosed] = "Closed", BLANK(), [DailySplit] + DIVIDE(_lastclosedsplit, 6 ) )it worked like:
Anonymous
3 years agoNot applicable
FreemanZ
Super User
3 years agohi Anonymous
try to add a column like:
Column2 =
VAR _lastclosedsplit =
MAXX(
TOPN(
1,
FILTER(
TableName,
TableName[Date]<EARLIER(TableName[Date])
&&TableName[IsClosed]="Closed"
),
TableName[Date]
),
TableName[DailySplit]
)
RETURN
IF(
[IsClosed] = "Closed",
BLANK(),
[DailySplit] + DIVIDE(_lastclosedsplit, 6 )
)or
Column =
VAR _lastcloseddate =
MAXX(
FILTER(
TableName,
TableName[Date]<EARLIER(TableName[Date])
&&TableName[IsClosed]="Closed"
),
TableName[Date]
)
VAR _lastclosedsplit =
MAXX(
FILTER(
TableName,
TableName[Date]=_lastcloseddate
),
TableName[DailySplit]
)
RETURN
IF(
[IsClosed] = "Closed",
BLANK(),
[DailySplit] + DIVIDE(_lastclosedsplit, 6 )
)
it worked like:
- Anonymous3 years agoNot applicable
Thanks a ton FreemanZ
This really worked 😍
Can you teach me please! - Anonymous3 years agoNot applicable
How to solve this if the DailySplit is not the max number for closed dates FreemanZ ??
- FreemanZ3 years ago
Super User
hi Anonymous
it shall still work, as MAXX here is actually calculating the max on a single value itself, filtered by the first argument of MAXX. Just give it a try.