Forum Discussion
SUMX help for total
Hi, I have some numbers that I have managed to calculate on a row level but they don't sum up properly for using on a card visual.
I think I need to use SUMX but I don't know how to implement it, I've tried with no success ☹️
I have a measure from one table which looks at potential sales based on how many hours a shop is open for (percentage) using two columns in one table as below:
| Area | Max potential sales | Opening hours | Actual potential sales |
| France | 10,000 | 75% | 7,500 |
| Spain | 50,000 | 50% | 25,000 |
| Germany | 20,000 | 25% | 5,000 |
I then have a measure which mulitplies Max potential sales by the availability of opening hours which gives me this data below which works fine but when I come to the total at the bottom it's way too high. Can anyone tell me what I need to do please?
This is what works on a row level but not for the total:
'Actual potential sales = sumx(Sales, Sales[Max potential sales])* SUMX(Sales, Sales[Opening hours])
| Area | Actual potential sales |
| France | 7,500 |
| Spain | 25,000 |
| Germany | 5,000 |
| Total | 1,500,000* |
*(i've made this number up but it's completely out)
Any help would be a massive help thank you!
Hi samc_26 ,
You are using SUMX separately for each column and then multiplying the results, which leads to an incorrect total calculation.
This is updated measure:Actual potential sales = SUMX( Sales, Sales[Max potential sales] * Sales[Opening hours] )
2 Replies
- Bibiano_Geraldo
Super User
Hi samc_26 ,
You are using SUMX separately for each column and then multiplying the results, which leads to an incorrect total calculation.
This is updated measure:Actual potential sales = SUMX( Sales, Sales[Max potential sales] * Sales[Opening hours] )- samc_26
Helper IV
Hi Bibiano_Geraldo , this worked great thank you!