Forum Discussion
CTH2022
3 years agoFrequent Visitor
Table showing incorrect total
Total is incorrect. Need help to fix the issue.
amitchandak
3 years agoSuper User
CTH2022 , Try like
top 2 =
var rankingcontext = values(Sheet1[TYPE])
return
Sumx(Summarize(Sheet1, Sheet1[STATION], Sheet1[Program], "_1",
calculate([counting],
topn(2,all(Sheet1[TYPE]),
[counting]),rankingcontext)),[_1])
CTH2022
3 years agoFrequent Visitor
The solution seems to work. However, when I added more data, the table started to display more than top 2 per station. Need help to fix this.
| Program | STATION | TYPE |
| A | S1 | F1 |
| A | S1 | F1 |
| A | S2 | F2 |
| A | S2 | F2 |
| A | S1 | F3 |
| A | S2 | F3 |
| A | S2 | F3 |
| A | S1 | F2 |
| A | S1 | F3 |
| A | S2 | F2 |
| A | S2 | F2 |
| A | S1 | F1 |
| A | S1 | F1 |
| A | S2 | F1 |
| B | S2 | F3 |
| B | S1 | F3 |
| B | S2 | F3 |
| B | S2 | F3 |
| B | S1 | F3 |
| B | S1 | F3 |
| B | S2 | F3 |
| B | S2 | F3 |
| A | S1 | F1 |
| A | S1 | F1 |
| A | S2 | F2 |
| A | S2 | F2 |
| A | S1 | F3 |
| A | S2 | F3 |
| A | S2 | F3 |
| A | S1 | F2 |
| A | S1 | F3 |
| A | S2 | F2 |
| A | S2 | F2 |
| A | S1 | F1 |
| A | S1 | F1 |
| A | S2 | F1 |
| B | S2 | F3 |
| B | S1 | F4 |
| B | S2 | F4 |
| B | S2 | F5 |
| B | S1 | F4 |
| B | S1 | F4 |
| B | S2 | F5 |
| B | S2 | F3 |