Forum Discussion
SUM THE LATEST VALUES
- Anonymous7 years ago
Hi novicenovice,
You can use below measure to achieve your requirement:
Last Total = VAR currDate = MAX ( 'DateTable'[Date] ) VAR summary = SUMMARIZE ( FILTER ( ALLSELECTED ( Table ), [Input Date] <= currDate ), [Customer], "LastDate", MAX ( Table[INPUT DATE] ) ) RETURN SUMX ( CALCULATETABLE ( Table, INTERSECT ( SELECTCOLUMNS ( Table, "CUSTOMER", [CUSTOMER], "Date", [INPUT DATE] ), summary ) ), [VALUE] )Regards,
Xiaoxin Sheng
Hi novicenovice,
You can use below measure to achieve your requirement:
Last Total =
VAR currDate =
MAX ( 'DateTable'[Date] )
VAR summary =
SUMMARIZE (
FILTER ( ALLSELECTED ( Table ), [Input Date] <= currDate ),
[Customer],
"LastDate", MAX ( Table[INPUT DATE] )
)
RETURN
SUMX (
CALCULATETABLE (
Table,
INTERSECT (
SELECTCOLUMNS ( Table, "CUSTOMER", [CUSTOMER], "Date", [INPUT DATE] ),
summary
)
),
[VALUE]
)
Regards,
Xiaoxin Sheng
- novicenovice7 years ago
Helper I
Thanks Anonymous, it works perfectly.
:smileyhappy:
- Anonymous6 years agoNot applicable
Anonymous
Hi,
I have the same issue (https://community.powerbi.com/t5/Desktop/summing-the-latest-entry-by-date/m-p/859750#M412467 topic is currently hidden for spam)
I've tried your forumula but it's only summing the values from the specific date
I am using <= currDate
table on the left is the date ( I am using BRANCH KEY rather than CUSTOMER in OP). Table on the right is the date from the definition date table along with your measure, line graph on the right is the visualisation. Any idea what might be going wrong?
Last Total =VAR currDate = MAX ( 'Period Definition'[Date])VAR summary =SUMMARIZE(FILTER ( ALLSELECTED('Stockloss Reporting Dynamic Date table') , 'Stockloss Reporting Dynamic Date table'[Date] <= currDate), 'Stockloss Reporting Dynamic Date table'[Branch Key Real],"LastDate", MAX ( 'Stockloss Reporting Dynamic Date table'[Date]))RETURNSUMX (CALCULATETABLE ('Stockloss Reporting Dynamic Date table',INTERSECT (SELECTCOLUMNS ( 'Stockloss Reporting Dynamic Date table', "Branch Key Real", 'Stockloss Reporting Dynamic Date table'[Branch Key Real], "Date", 'Stockloss Reporting Dynamic Date table'[Date] ),summary)),'Stockloss Reporting Dynamic Date table'[FINAL ANNUALISED ADJ VAL FIGURE])