Forum Discussion
Clustered Column Using Inscope
Hi all,
I have been asked to created a Clustered Column chart which is filtered based on a Slicer with a Hierarchy of the company.
The issue I have is that I am using inscope to return the max values for the BRAG based on the slicer selected, however when I select a different level of the hierarchy in the slicer, it only slices on the top level in the hierarchy.
Any ideas on why this is happening or how to fix this?
This is the measure for inscope....Cost Centre is the lowest level in the hirearchy
Thanks
Hi Anonymous ,
The reason you’re encountering this issue is that SELECTEDVALUE only returns a result when there’s a single item in context. If multiple cost centres are present, it returns blank, which is why you’re not seeing any values.
To address this, you can use HASONEVALUE in your measure. This approach checks if only one item exists at each level and then returns the appropriate BRAG value:
Total BRAG Norm = SWITCH ( TRUE(), HASONEVALUE('Cost Centres'[BU_LABEL]), MAX(SummarizedTableNorm[BU_TOTAL_BRAG]), HASONEVALUE('Cost Centres'[DIVISION_LABEL]), MAX(SummarizedTableNorm[DIV_TOTAL_BRAG]), HASONEVALUE('Cost Centres'[OM_LABEL]), MAX(SummarizedTableNorm[OM_TOTAL_BRAG]), HASONEVALUE('Cost Centres'[AREA_LABEL]), MAX(SummarizedTableNorm[BDM_TOTAL_BRAG]), HASONEVALUE('Cost Centres'[COST_CENTRE_LABEL]), MAX(SummarizedTableNorm[GM_TOTAL_BRAG]) )This should prevent blanks when slicing at higher levels. If you continue to see blanks at the cost centre level, consider adding a fallback aggregation such as MAXX or SUMX across cost centres to ensure the measure returns a value when multiple centres are involved.
I haven’t tested this in your specific model, so please use it as a starting point. If you continue to encounter blanks at the lowest level, consider adding a fallback aggregation such as MAXX or SUMX over the cost centres to address situations where multiple cost centres are included.
Let's give it a try and let us know how it goes.
10 Replies
- rohit1991Super User
Hii Anonymous
INSCOPE() only checks what level of the visual axis is currently being evaluated.
It does not react to slicers that change the hierarchy level so when you slice higher levels (BU, Division, OM, etc.), the visual still evaluates the lowest level present in the visual, which in your case is always Cost Centre.
That’s why your measure always returns the first branch of the SWITCH() and behaves like it only slices the top level.To fix the behaviour, you must detect the slicer selection using HASONEVALUE() (or SELECTEDVALUE) instead of INSCOPE
- AnonymousNot applicable
Thanks Rohit1991 for the reply, that makes sense, how would I use this within my measure?
- danextianSuper User
Hi Anonymous
I'm not exactly sure what you're trying to achieve but if the order of the columns in your switch measure is the actual hierarchy then that is because the first condition is already met which will always holds true even if you expand into the next level in the hierarchy - ie, it is always inscope - so you get only the value for the first hierarchy. Try reversing the order.
- AnonymousNot applicable
Sorry, I have it, this is the new measure I have created and seems to work until I choose the lowest level then it returns blank values
Total BRAG Norm =SWITCH (TRUE (),SELECTEDVALUE( 'Cost Centres'[BU_LABEL] ,MAX ( SummarizedTableNorm[BU_TOTAL_BRAG])),SELECTEDVALUE ( 'Cost Centres'[DIVISION_LABEL] , MAX ( SummarizedTableNorm[DIV_TOTAL_BRAG] )),SELECTEDVALUE ( 'Cost Centres'[OM_LABEL] , MAX ( SummarizedTableNorm[OM_TOTAL_BRAG] )),SELECTEDVALUE ( 'Cost Centres'[AREA_LABEL], MAX ( 'SummarizedTableNorm'[BDM_TOTAL_BRAG] )),SELECTEDVALUE ( 'Cost Centres'[COST_CENTRE_LABEL] , MAX ( 'SummarizedTableNorm'[GM_TOTAL_BRAG]))) - AnonymousNot applicable
So if it helps, the Cost Centre Label has more than 1 label associated to the parent in the hierarchy, will this be the reason why I am returning blanks
- amitchandakSuper User
Anonymous , if you can use a field parameter for the axis. I have created this example to change the measure based on that
Changing measures based on the axis with Field Parameters in Power BI. Dynamic measures based on the axis/Dimension: https://youtu.be/7ikRAelDph0- AnonymousNot applicable
Thank-you for the reply Amit. I don't think that will work for me I am afraid, although very comprehensive.
I can see all the hierarchies within the slicer and of the 5 levels, the clustered chart will be filtered on the 1st 4 levels.
However when I click on the Centre Level (Lowest Level), it returns blanks values and when I put it into a table it just lists the name of the Centre rather than the values it should show (Ie Score for each Month of 2025)