Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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
Solved! Go to Solution.
Hi @AMCMILLAN ,
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.
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
@AMCMILLAN , 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
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)
Hi @AMCMILLAN ,
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.
Thank-you for the reply, it worked but needed to change the list so that COst centre was at the top and BU at the bottom. Was the last part of the puzzle and now can go live.
Thank-you again.
Thanks for the update. Stay engaged with the community for upcoming discussion
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
Hi @AMCMILLAN
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.
Hii @AMCMILLAN
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
Thanks Rohit1991 for the reply, that makes sense, how would I use this within my measure?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 39 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 73 | |
| 73 | |
| 38 | |
| 35 | |
| 26 |