Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
JadeM
Frequent Visitor

Display dynamic 'reduction targets' across multi-level hierarchy in column chart

Hi all, I would appreciate some advice on a problem I have been looking at for a while. This is to do with reporting on different sustainability targets.

 

I want to make a clustered column chart that shows both the performance of a company towards in reducing various measures (eg water use) and the reduction target (ie. reduce X by 50%).

 

The different targets have different sub-targets, so I have built a hierarchy.

 

One issue is that the main targets that will be shown in this column chart are at different levels of the hierarchy, I have therefore unpivoted the different levels to create one column called 'Value'.

  • Examples of this (sample data below) are that 'GHG Emissions' and 'Waste' are Level 1 targets that need to be included, 'Heating' is a level 2 target that needs to be included and 'International flights' and 'domestic flights' are level 3 targets to be included in this column chart.
  • I cannot change the hierarchy so that these values are all in the same level unfortunately! 

 

This approach works fine and I can see the appropriate target categories. The issue is with the reduction target figure that is also included in the clustered column chart (ie. reduce X by 50%). When I use drill down to see other levels in the hierarchy the target from the first level of the hierarchy propagates through to all lower levels. This is a problem because some of the sub targets have their own reduction target and I would like the chart to change to show the sub targets when drill down is used.

 

 

Example:

Target level 1 is GHG emissions: this has a reduction target of -50%

GHG emissions breaks down into a handful of different subcategories like cars, heating etc. 'Heating' is a sub target that falls under GHG emissions as Target level 2 and it has a reduction taregt of -60%.

 

So in this example I would initally like the reduction target column on the chart to show -50%, then when users drill down on that column I want to see 'Heating' to have a reduction target column of -60% (and other Target Level 2 categories to retain -50%)

 

How can I achieve this? I can restructure my data if needed.

 

This is my current set up (Many to One relationship between 'Fact' and 'Hierarchy' on the 'Hierarchy ID' column

Screenshot 2025-02-24 at 16.52.12.png

Columns used in my column chart:

X-axis:

'Fact'[Value]

Target Hierarchy (this is the name of the hierarchy I built in Power BI)

'Hierarchy'[Targets Level 1]

'Hierarchy'[Targets Level 1]

'Hierarchy'[Targets Level 1]

 

Y-axis:

'Fact'[Reduction Target] (this is a measure I made below)

'Fact'[Performance]

 

Sample of the hierarchy table:

Targets Level 1Targets Level 2Targets Level 3Hierarchy Key
GHG EmissionsHeatingGas1
GHG EmissionsHeatingElectric2
GHG EmissionsCarsPetrol Cars3
GHG EmissionsCarsElectric Cars4
GHG EmissionsFlightsDomestic Flights5
GHG EmissionsFlightsInternational Flights6
WasteWasteIncinerated Waste7
WasteWasteFood Waste8
WasteWasteLandfill Waste9
WaterWater Used 10

 

Sample of the Fact table:

Hierarchy KeyAttributeValueReduction Target 1Reduction Target 2Reduction Target 3
1Targets Level 1GHG Emissions-0.50-0.60-0.60
1Targets Level 2Heating-0.50-0.60-0.60
1Targets Level 3Gas-0.50-0.60-0.60
2Targets Level 1GHG Emissions-0.50-0.60-0.60
2Targets Level 2Heating-0.50-0.60-0.60
2Targets Level 3Electric-0.50-0.60-0.60
3Targets Level 1GHG Emissions-0.50-0.50-0.50
3Targets Level 2Cars-0.50-0.50-0.50
3Targets Level 3Petrol Cars-0.50-0.50

-0.50

 

So far all I have thought of is using a measure like the below, but this does not work (obviously):

 

Reduction Target =
VAR CurrentLevel = SELECTEDVALUE('Fact'[Value])
VAR ReductionTarget1 = MAX('Fact'[Reduction Target 1])
VAR ReductionTarget2 = MAX('Fact'[Reduction Target 2])
VAR ReductionTarget3 = MAX('Fact'[Reduction Target 3])

RETURN
SWITCH(
TRUE(),
CurrentLevel IN VALUES('Hierarchy'[Targets Level 1]), ReductionTarget1,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 2]), ReductionTarget2,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 3]), ReductionTarget3,
BLANK()
)

 

 

 When I use the above measure the reduction target is shown correctly on the inital view (when Fact[Value] is what is seen by the user). But when I drill down to see the hierarchy the target from the first level propogates through.

 

 

Any solutions welcome, it may be that making a measure like I have tried to do is the wrong approach!

1 ACCEPTED SOLUTION
v-denglli-msft
Community Support
Community Support

Hi @JadeM ,

 

Please try the following measure.

Reduction Target = 
VAR CurrentLevel = 
SWITCH(
TRUE(),
ISINSCOPE('Hierarchy'[Targets Level 3]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 3]),
ISINSCOPE('Hierarchy'[Targets Level 2]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 2]),
ISINSCOPE('Hierarchy'[Targets Level 1]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 1]),
ISINSCOPE('Fact'[Value]) = TRUE(),SELECTEDVALUE('Fact'[Value])
)
VAR ReductionTarget1 = MAX('Fact'[Reduction Target 1])
VAR ReductionTarget2 = MAX('Fact'[Reduction Target 2])
VAR ReductionTarget3 = MAX('Fact'[Reduction Target 3])
RETURN
SWITCH(
TRUE(),
CurrentLevel IN VALUES('Hierarchy'[Targets Level 1]), ReductionTarget1,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 2]), ReductionTarget2,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 3]), ReductionTarget3,
BLANK()
)

 

The test results are as follows.

The X-axis hierarchy is Value.

vdengllimsft_4-1740451099506.png

 

X-axis hierarchy drilled down to level 1.

vdengllimsft_5-1740451135997.png

 

X-axis hierarchy drilled down to level 2.

vdengllimsft_6-1740451177434.png

 

X-axis hierarchy drilled down to level 3.

vdengllimsft_7-1740451214959.png

 

Please see the attached pbix for reference.

 

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-denglli-msft
Community Support
Community Support

Hi @JadeM ,

 

Please try the following measure.

Reduction Target = 
VAR CurrentLevel = 
SWITCH(
TRUE(),
ISINSCOPE('Hierarchy'[Targets Level 3]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 3]),
ISINSCOPE('Hierarchy'[Targets Level 2]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 2]),
ISINSCOPE('Hierarchy'[Targets Level 1]) = TRUE(), SELECTEDVALUE('Hierarchy'[Targets Level 1]),
ISINSCOPE('Fact'[Value]) = TRUE(),SELECTEDVALUE('Fact'[Value])
)
VAR ReductionTarget1 = MAX('Fact'[Reduction Target 1])
VAR ReductionTarget2 = MAX('Fact'[Reduction Target 2])
VAR ReductionTarget3 = MAX('Fact'[Reduction Target 3])
RETURN
SWITCH(
TRUE(),
CurrentLevel IN VALUES('Hierarchy'[Targets Level 1]), ReductionTarget1,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 2]), ReductionTarget2,
CurrentLevel IN VALUES('Hierarchy'[Targets Level 3]), ReductionTarget3,
BLANK()
)

 

The test results are as follows.

The X-axis hierarchy is Value.

vdengllimsft_4-1740451099506.png

 

X-axis hierarchy drilled down to level 1.

vdengllimsft_5-1740451135997.png

 

X-axis hierarchy drilled down to level 2.

vdengllimsft_6-1740451177434.png

 

X-axis hierarchy drilled down to level 3.

vdengllimsft_7-1740451214959.png

 

Please see the attached pbix for reference.

 

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.