Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to make a bar chart where I compare two measures. One that is strictly dependent of the selector while the other one is only indirectly dependent of the selector.
Concretely, I have a selector where I can select a client. The first measure calculates the average of some field for the given selection. What I want to do in the second measure is to ignore the customer selection but instead filter based on the business sector of the customer selected.
My question: how can I, in the set analysis, express that I want to select the business sector of the customer that was selected with the selector without selecting the customer himself?
Any idea how I can do this? Much appreciated!
I might have found the solution. For anyone interested
=avg({<CustomerName=, CustomerIndustry = {`$(=ONLY({<CustomerName = {"$(=GetFieldSelections(CustomerName))"}>} CustomerIndustry ))`}>} YourMeasure)
The "CustomerName=" part ignores the selection
The {`$(=ONLY({<CustomerName = {"$(=GetFieldSelections(CustomerName))"}>} CustomerIndustry ))`} part get the industry of the selected customer
I might have found the solution. For anyone interested
=avg({<CustomerName=, CustomerIndustry = {`$(=ONLY({<CustomerName = {"$(=GetFieldSelections(CustomerName))"}>} CustomerIndustry ))`}>} YourMeasure)
The "CustomerName=" part ignores the selection
The {`$(=ONLY({<CustomerName = {"$(=GetFieldSelections(CustomerName))"}>} CustomerIndustry ))`} part get the industry of the selected customer
You can use the element function P() to accomplish what you are looking for in your second measure. In your set analysis,
{$<[Client]=,[BusinessSector]=P([BusinessSector])>}
[Client]= will cause the measure expression to ignore the selection in the [Client] field. P([BusinessSector]) returns the possible values for [BusinessSector]. The P function doesn't ignore the selection in [Client], so it will return the [BusinessSector] for the client selected.