Skip to main content
Announcements
Happy New Year! Cheers to another year of collaboration, connections and success.
cancel
Showing results for 
Search instead for 
Did you mean: 
d33paklala
Contributor II
Contributor II

Row Level Set Analysis

I have a hierarchy and need to calculate shares.

GeographyHierarchySales
Nation103
OM45
OMA6
OMA011
OMA022
OMA033
OMB 
OMB01 
OMB02 
OMB03 
OMC 
OMC01 
OMC02 
OMC03 
ON 
ONA 
ONA01 
ONA02 
ONA03 
ONB 
ONB01 
ONB02 
ONB03 
ONC 
ONC01 
ONC02 
ONC03 

 

TerritoryDistrictRegionNationSales
OMA01OMAOMNation1
OMA02OMAOMNation2
OMA03OMAOMNation3
OMB01OMBOMNation4
OMB02OMBOMNation5
OMB03OMBOMNation6
OMC01OMCOMNation7
OMC02OMCOMNation8
OMC03OMCOMNation9
ONA01ONAONNation10
ONA02ONAONNation5
ONA03ONAONNation6
ONB01ONBONNation7
ONB02ONBONNation8
ONB03ONBONNation9
ONC01ONCONNation10
ONC02ONCONNation1
ONC03ONCONNation2

 

Using Geography Hierarchy as dimension, I want to calculate shares in terr, district and region. For eg. share of territory OMA01 = Sales of OMA01 / Sales of District OMA

Share of district OM = Sales of OM / Sales of Rgion OM

Share of Region OM = Sales of OM / Sales of Nation 

 

I am able to achieve this by If - else condition however it doesn't work in set analysis.For territory shares,  I am using 

Sum({<District = {'$(=Left(GeographyHierarchy,3))' } >}Sales). This works on a single selection though. 

 

PS : Geography Hierarchy is associated with Terr, District, Region and nation accurately. I.e. Nation under geo hierarchy has all territories, districts, region and Nation value against it and so on.

Labels (1)
2 Replies
marcus_sommer

A real set analysis worked on a column-level and therefore it's not possible to get row-level sensitive comparisons. You may write something like:

Sum({< Sales = {"=District=Left(GeographyHierarchy,3))" } >} Sales)

but it's quite the same like your if-loop.

- Marcus

d33paklala
Contributor II
Contributor II
Author

Thanks Marcus. I would have preferred using the suggestion however it has a high response time and also doesn't return correct results. The hardcoded if - else return accurate data, and is compararatively better in terms of performance