Forum Discussion
Ackbar-Learner
Resolver I
3 years agoUnderstanding EOMONTH in DAX
Hi, I am having a very strange situation with EOMONTH Below is the measure I am using to get last day of previous month of either the selected date or today's date whichever comes first: Board0...
- 3 years ago
Hi,
I am not sure how your datamodel looks like, but please try something like below whether it suits your requirement.
Board02bP&LAllTransactionAmountwithSignActual = VAR _Board01fActualizedDateSelected = [Board01fActualizedDateSelected] VAR Result = SUMX ( GLChartOfAccounts, CALCULATE ( [P&LAllTransactionAmountEUR], FILTER ( ALL ( GLAccountClientUser[GLAccountValue] ), GLAccountClientUser[GLAccountValue] < 4700000 ), FILTER ( BudgetCalendar, BudgetCalendar[Date] <= _Board01fActualizedDateSelected ) ) * GLChartOfAccounts[Sign] ) RETURN Result
andrewpirie
Resolver II
3 years agoAm I correct that Board01aLastDateSelected measure doesn't rely on a specific GLChartOfAccounts? If so, the measure may be being affected by the context transition of the GLChartOfAccounts row being iterated over in SUMX.
Something to try is moving that measure reference to a variable outside of that expression and referring to that variable within the FILTER statement so that it is evaluated outside of the currently iterated row context, like below
Board02bP&LAllTransactionAmountwithSignActual =
VAR _actualizedDateSelected = [Board01fActualizedDateSelected]
VAR Result = sumx(GLChartOfAccounts,
CALCULATE([P&LAllTransactionAmountEUR],
FILTER(all(GLAccountClientUser[GLAccountValue]),GLAccountClientUser[GLAccountValue]<4700000),
FILTER(BudgetCalendar,BudgetCalendar[Date]<= _actualizedDateSelected ))
*GLChartOfAccounts[Sign])
RETURN
Result
Ackbar-Learner
Resolver I
3 years agoIt is the same as the first solution proposed. You were both right!