Forum Discussion
Divide filtered values (by other table) by total values
- 7 years ago
Hi TonyBI
Based on my previous solution, i add the following steps to acheive your second goal.
1.create a column in Table1
month_total = CALCULATE(SUM(Table1[VALUE]),ALLEXCEPT(Table1,Table1[YEAR/MONTH1]))
2. create measures in Table2
Measure 2 = CALCULATE(MAX(Table2[DATE]),ALLEXCEPT(Table2,Table2[ITEM],Table2[YEAR/MONTH2])) Measure 3 = CALCULATE(SUM(Table2[VALUE]),FILTER(Table2,Table2[DATE]=[Measure 2])) Measure 4 = SUMX(ALLEXCEPT(Table2,Table2[YEAR/MONTH2]),[Measure 3]) Measure 5 = CALCULATE(MAX(Table1[month_total]),FILTER(Table2,Table2[YEAR/MONTH2]=MAX(Table1[YEAR/MONTH1]))) Measure 6 = IF([Measure 5]<>BLANK(),[Measure 4]/[Measure 5])
Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi TonyBI
I don't undertsand this " the other thing that would be nice to do is to sum the latest value found on TABLE 2 (for every month)".
Please give me an example based on the example data.
Let to say, for item A in 201901?
Best Regards
Maggie
- TonyBI7 years ago
Helper I
Maggie! thx very much!
To clarify the second part of the question, this is what I mean:
Table 2 has every value for each month (I changed the values to be more specific - Notice that some items have many values for the same month, but diffent days).
ITEM VALUE DATE A 12 01/01/2019 A 11 01/02/2019 A 11 01/03/2019 B 4 01/01/2019 B 3 01/02/2019 C 2 01/01/2019 C 4 01/03/2019 C 2 01/08/2019 C 2 09/02/2019 D 2 01/01/2019 D 1 01/11/2019 F 4 12/01/2019 F 3 01/14/2019 G 4 05/01/2019 T 4 06/02/2019 So, I would like to sum Every last value for each item, each month. In this case (january only), this should be the result:
ITEM VALUE DATE A 11 01/03/2019 B 3 01/02/2019 C 2 01/08/2019 D 1 01/11/2019 F 3 01/14/2019 Total sum should be 20. Finally, I would divide "20" by total values of table 1 ("46" for january).
This will allow me to know the percentage of certified values by month.
Thx in advance!