Forum Discussion
Lastnonblank
- 4 years ago
Hi, bhelou
Try this:
lastDate = CALCULATE(MAX('Table'[DEPRN_RUN_DATE]),ALLEXCEPT('Table','Table'[ASSET_ID]))result = VAR _t = ADDCOLUMNS ( 'Table', "lastDate", [lastDate] ) VAR _tt = SUMMARIZE ( _t, [ASSET_ID], [lastDate], "cost", CALCULATE ( SUM ( 'Table'[ADJUSTED_COST] ), FILTER ( 'Table', 'Table'[DEPRN_RUN_DATE] = [lastDate] ) ) ) RETURN SUMX ( _tt, [cost] )Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.
This works well in my sample, please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dear ,
THe measure worked , but the sum in the table is wrong = 13 K ( i exported to excel it gave me 25 M and is the correct figure ) it should be as the table below . 25M
thanks ,
Hi, bhelou
Try this:
lastDate = CALCULATE(MAX('Table'[DEPRN_RUN_DATE]),ALLEXCEPT('Table','Table'[ASSET_ID]))result =
VAR _t =
ADDCOLUMNS ( 'Table', "lastDate", [lastDate] )
VAR _tt =
SUMMARIZE (
_t,
[ASSET_ID],
[lastDate],
"cost",
CALCULATE (
SUM ( 'Table'[ADJUSTED_COST] ),
FILTER ( 'Table', 'Table'[DEPRN_RUN_DATE] = [lastDate] )
)
)
RETURN
SUMX ( _tt, [cost] )
Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.
This works well in my sample, please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- bhelou4 years agoResponsive Resident
Many Thanks , it worked