Forum Discussion
How to Show Contiguous Sum Trend Based on Timestamped Value Table
- 6 years ago
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar = CALENDARAUTO()There is no relationship between two tables. You may create a measure as below.
Result = var tab = ADDCOLUMNS( SUMMARIZE( FILTER( ALL('Table'), 'Table'[Update Date]<=SELECTEDVALUE('Calendar'[Date]) ), 'Table'[Product Name], 'Table'[Part Number], "MaxDate",MAX('Table'[Update Date]) ), "Cost", CALCULATE( SUM('Table'[Part Cost]), FILTER( ALL('Table'), 'Table'[Product Name]=EARLIER('Table'[Product Name])&& 'Table'[Part Number]=EARLIER('Table'[Part Number])&& 'Table'[Update Date]=EARLIER([MaxDate]) ) ) ) return SUMX( FILTER( tab, [Product Name]=SELECTEDVALUE('Table'[Product Name]) ), [Cost] )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar = CALENDARAUTO()
There is no relationship between two tables. You may create a measure as below.
Result =
var tab =
ADDCOLUMNS(
SUMMARIZE(
FILTER(
ALL('Table'),
'Table'[Update Date]<=SELECTEDVALUE('Calendar'[Date])
),
'Table'[Product Name],
'Table'[Part Number],
"MaxDate",MAX('Table'[Update Date])
),
"Cost",
CALCULATE(
SUM('Table'[Part Cost]),
FILTER(
ALL('Table'),
'Table'[Product Name]=EARLIER('Table'[Product Name])&&
'Table'[Part Number]=EARLIER('Table'[Part Number])&&
'Table'[Update Date]=EARLIER([MaxDate])
)
)
)
return
SUMX(
FILTER(
tab,
[Product Name]=SELECTEDVALUE('Table'[Product Name])
),
[Cost]
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.