Forum Discussion
Find sum based on filter
- 7 years ago
Hi unnijoy ,
By my test, you could create a irrelative table as a slicer to filter the values. I create a sample using two ways you can have a try.
- Create a new table. And the values I added is the same as your sample data. There is no relationship between two tables.
- Create measures.
Method 1:
Note : it will show the original values and the expected total.
Measure = var a = SELECTEDVALUE(Table2[Month ]) return CALCULATE(SUM(Table1[Status]),FILTER(Table1,MAX(Table1[Month ])<=a))
Measure 2 = IF(ISFILTERED(Table2[Month ]),CALCULATE(SUMX(Table1,Table1[Measure]),ALLEXCEPT(Table1,Table1[Month ])),SUM(Table1[Status]))Method 2:
Note: It will show blank by default.
Measure 3 = IF(ISFILTERED(Table2[Month ]) && MAX(Table1[Month ])<=SELECTEDVALUE(Table2[Month ] ),SUMX(FILTER(ALL(Table1),'Table1'[Month ] <=SELECTEDVALUE(Table2[Month ])),Table1[Status]))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi unnijoy ,
By my test, you could create a irrelative table as a slicer to filter the values. I create a sample using two ways you can have a try.
- Create a new table. And the values I added is the same as your sample data. There is no relationship between two tables.
- Create measures.
Method 1:
Note : it will show the original values and the expected total.
Measure = var a = SELECTEDVALUE(Table2[Month ]) return CALCULATE(SUM(Table1[Status]),FILTER(Table1,MAX(Table1[Month ])<=a))
Measure 2 = IF(ISFILTERED(Table2[Month ]),CALCULATE(SUMX(Table1,Table1[Measure]),ALLEXCEPT(Table1,Table1[Month ])),SUM(Table1[Status]))
Method 2:
Note: It will show blank by default.
Measure 3 = IF(ISFILTERED(Table2[Month ]) && MAX(Table1[Month ])<=SELECTEDVALUE(Table2[Month ] ),SUMX(FILTER(ALL(Table1),'Table1'[Month ] <=SELECTEDVALUE(Table2[Month ])),Table1[Status]))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.