I have two categorical columns "Job Industry Categories" and "Wealth Segment" and I can create a crosstab using "Job Industry Categories" in rows and "Wealth Segment" to count values for each industry.
This is how my crosstab looks like currently:
But I want to dynamically count wealth segment column for each industry and then return the wealth segment with maximum count for each industry.
This is what I want to acheive:
What I have tried:
I have tried using LOD expression to get the max of count of wealth segment for each industry but that returns a non-aggregated value and I am not able to extract the wealth segment label for the corresponding value.
MAX(
{ FIXED [Job Industry Category], [Wealth Segment] : COUNT([Wealth Segment]) }
)
I have also tried using IF THEN statement with LOD Expression but, since LOD expression is a non-aggregated value, it throws error. This is what I tried:
IF
{ FIXED [Job Industry Category], [Wealth Segment] : COUNT([Wealth Segment]) } = MAX(
{ FIXED [Job Industry Category], [Wealth Segment] : COUNT([Wealth Segment]) })
THEN
[Wealth Segment]
END
ERROR: cannot mix aggregate and non-aggregate with this function
Thanks in advance.