Forum Discussion
TheHans
Helper I
4 years agoCreate a measure with aggregated values considering existing filters
Dear Community,
I have a project table containing many projects and values per month. I would like to create a measure that accumulates all values p to a certain date but considering existing filters, such as for example only for "Project A" if this is chosen in the visual filters.
ProjectFinancials Table
| ProjectID | Value | Period YM | PropertyABC |
| Project A | 10 | 202201 | e |
| Project A | 20 | 202202 | f |
| Project A | 30 | 202203 | g |
| Project A | 25 | 202204 | g |
| Project A | 48 | 202205 | f |
| Project A | 15 | 202206 | e |
| Project B | 84 | 202201 | r |
| Project B | 85 | 202202 | r |
| Project B | 29 | 202203 | r |
| Project B | 67 | 202204 | z |
| Project B | 28 | 202205 | z |
| Project B | 44 | 202206 | s |
Now I have created a measure like this, however this one does not consider any filters (since I chose "ALL").
PlannedAcc =
VAR EndDate = SELECTEDVALUE(DateTable[Period YM]) // this is a value YYYYMM
RETURN
SUMX(
CALCULATETABLE(
'FACT-Project Financials',
ALL('FACT-Project Financials'),
'FACT-Project Financials'[Period YM] <= EndDate
),
'FACT-Project Financials'[Value]
)
I plan to use a clustered column chart with the months on the x-axis and the cumulated values per month. Any filter applied to the chart, such as project ID or some other property needs to take effect on the cumulated values.
Can anyone help?
Thanks in advance
H.
Hi TheHans ,
try this.
PlannedAcc = VAR EndDate = MAX(DateTable[Period YM]) // this is a value YYYYMM RETURN CALCULATE( SUM('FACT-Project Financials'[Value]), FILTER(ALL(DateTable), DateTable[Period YM] <= EndDate) )