Forum Discussion
Last month submitted based on id
Consider the below table
| id | month submitted | budget |
| 101 | 01/06/2020 | 50 |
| 101 | 01/07/2020 | 100 |
| 103 | 01/06/2020 | 50 |
| 103 | 01/07/2020 | 50 |
| 103 | 01/08/2020 | 50 |
| 103 | 01/08/2020 | 20 |
I'm looking to create a measures or a new table
- subset the above table based on the last month submitted date for each id ; no aggregation is required.
Desired output is a table as below. To confirm it's not subset by latest overall last month submitted, but last month submitted given the id.
| last month date | budget | |
| 101 | 01/07/2020 | 100 |
| 103 | 01/08/2020 | 20 |
| 103 | 01/08/2020 | 50 |
Thank you in advance
- Anonymous5 years ago
You can achieve your goal by build a measure or build calculated tables.
Measure:
Measure = Var _MaxDatePerID = MAXX(FILTER(ALL('Table'),'Table'[id]=MAX('Table'[id])),'Table'[month submitted]) Return IF(MAX('Table'[month submitted])=_MaxDatePerID,1,0)Add the measure into table visual's Filter Field and set the measure to show items when the value =1.
Result is as below.
Calculated Table:
Subset = CALCULATETABLE('Table',FILTER('Table','Table'[month submitted] = MAXX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[month submitted])))Subset2 = SUMMARIZE(FILTER('Table','Table'[month submitted]=MAXX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[month submitted])),'Table'[id],'Table'[month submitted],'Table'[budget])Results are the same:
You can download the pbix file from this link: Last month submitted based on id
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
You can achieve your goal by build a measure or build calculated tables.
Measure:
Measure = Var _MaxDatePerID = MAXX(FILTER(ALL('Table'),'Table'[id]=MAX('Table'[id])),'Table'[month submitted]) Return IF(MAX('Table'[month submitted])=_MaxDatePerID,1,0)Add the measure into table visual's Filter Field and set the measure to show items when the value =1.
Result is as below.
Calculated Table:
Subset = CALCULATETABLE('Table',FILTER('Table','Table'[month submitted] = MAXX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[month submitted])))Subset2 = SUMMARIZE(FILTER('Table','Table'[month submitted]=MAXX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[month submitted])),'Table'[id],'Table'[month submitted],'Table'[budget])Results are the same:
You can download the pbix file from this link: Last month submitted based on id
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.