Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rerebecky
Contributor
Contributor

Calculated dimension

Hi I am would like to create a table showing revenue based on number of countries where companies have sales.

No of countries we have salesrevenue
15K
210K
320K

 

However, my approach could not show when I want to see.

I have field: "SalesCountries', "Revenue", "CompanyName".

And I create a variable called "NoOfCountries", with express Count(Distinct([SalesCountries]))

Then I created a calculated dimension with this expression:

Aggr(SUM(IF(NoOfCountries=1,'1',
IF(NoOfCountries=2,'2',
IF(NoOfCountries=3,'3',
IF(NoOfCountries=4,'4',
IF(NoOfCountries=5,'5',
IF(NoOfCountries>=6 and NoOfCountries <=10,'6-10',
IF(NoOfCountries>=6 and NoOfCountries <=15,'11-15',
IF(NoOfCountries>=15 and NoOfCountries <=20, '16-20',
IF(NoOfCountries>=20 and NoOfCountries <=25, '21-25',
'above 25')))))))))),CompanyName)

However, It doesn't work as expected and end up showing column with a list of countries.

can anyone help me solve this issue please?

2 Replies
tresesco
MVP
MVP

Could you share a sample data set with expected output?
rerebecky
Contributor
Contributor
Author

Data:

CompanyNameSalesCountriesYTD revenue
AChina100
AGermany100
AThailand100
AJapan100
AKorea100
BKorea100
BJapan100
CChina100
DChina100
EChina100
FChina100
FThailand100
FJapan100
GUS100
GChina100

 

expected output:

No of Countries SalesRevenue
5500.0
40
3300
2400
1300
Above 60