Forum Discussion

marcobaciga's avatar
marcobaciga
Helper I
8 years ago
Solved

set value field in report powerbi by custom visual

Hi, I must in m y custom visual to send a value like filter in each visual object in my report powerbi when i click a icon. Is it possible?   Thank you   Marco  
  • v-viig's avatar
    v-viig
    8 years ago

    This code snippet is going to address the issue:

    let selectionIds = [];
    
    selectionIds.push(host.createSelectionIdBuilder()
        .withCategory(categorical.categories[0], 0)
        .createSelectionId()
    );
    
    selectionIds.push(host.createSelectionIdBuilder()
        .withCategory(categorical.categories[1], 0)
        .createSelectionId()
    );
    
    selectionIds.push(host.createSelectionIdBuilder()
        .withCategory(categorical.categories[0], 1)
        .createSelectionId()
    );
    
    selectionIds.push(host.createSelectionIdBuilder()
        .withCategory(categorical.categories[1], 1)
        .createSelectionId()
    );
    
    selectionIds.forEach((selectionId) => {
        this.selectionManager.select(selectionId, true)
    });

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]