Forum Discussion

JadeM's avatar
JadeM
Frequent Visitor
1 year ago
Solved

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 t...
  • Anonymous's avatar
    Anonymous
    1 year ago

    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.

     

    X-axis hierarchy drilled down to level 1.

     

    X-axis hierarchy drilled down to level 2.

     

    X-axis hierarchy drilled down to level 3.

     

    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.