0

I'm trying to change the value of a hierarchy slicer using powerbi-client and setSlicerState, but the function setSlicerState only takes an object of type ISlicerState as input. However, for hierarchy slicer we need to pass an object using this format:

const filter =
      {
        $schema: 'http://powerbi.com/product/schema#hierarchy',
        filterType: 9,
        target,
        hierarchyData
      }

This format doesn't respect the interface ISlicerState so how can I achieve what I want to do?

I used the documentation at https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/control-report-slicers#hierarchy-filter

However, it looks like this documentation is wrong since I did exactly what they said, but it's not working: enter image description here

Even if they do it in the doc:

enter image description here

1 Answer 1

0

I've found why I wasn't able to see anything with hierarchy. It is because I was using an old version (2.18.5) and this version doesn't have the possibility to set hierarchy slicer. I updated my package version to 2.21.1.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.