Forum Discussion
Help with Summarize
- 6 years ago
I ended up with this for my DAX:
T2 = SUMMARIZE( Table, Table[NAME1], "DATE2", LASTDATE( Table[DATE1] ), "NUM2", CALCULATE( FIRSTNONBLANK( Table[NUM1], 1 ), LASTDATE( Table[DATE1] ) ) )wherein the temporary table returned from LASTDATE propagated filter to orginal Table and then to CALCULATE
Hi hansei ,
This would be my approach, I sure there are other way to achieve the same 🙂
Table 2 = ADDCOLUMNS(
SUMMARIZE('Table', 'Table'[NAME1], "LastDate", max('Table'[DATE1])), "Number",
var currentName1 = 'Table'[NAME1]
return
calculate (sum('Table'[NUM1]),
filter('Table', 'Table'[NAME1] = currentName1),
filter('Table', 'Table'[DATE1] = [LastDate])))
The Summarize will give you table with names and last dates.
Then you have to calculate / collect the number value from the table based on Name and last date. There can be multiple names with the same last date (at least in theory). That is why both name and last date are used in the calculate to find the correct value.
Hope this helps
jan
- hansei6 years agoHelper V
Hello Anonymous ,
I'm unsure why, but your solution doesn't seem to filter on LastDate. It aggregates all row entries withe the SUM(). It does the same even when written
filter('Table', 'Table'[NAME1] = currentName1 && 'Table'[DATE1] = [LastDate] )resulting in e.g. 55 for harry
- Anonymous6 years agoNot applicable