Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Returning multiple slicer values based off one slicer selection

In power bi I have a table with two columns called AltOrgCode which is a list of codes, and a column called OrgAbbreviated which is a list of organizations, AltOrgCodes only contains distinct values ...
  • v-hashadapu's avatar
    v-hashadapu
    1 year ago

    Hi Anonymous , Thank you for reaching out to the Microsoft Community Forum.

     

    Create a mapping table that captures the relationship between AltOrgCodes and OrgAbbreviated. Example:

    AltOrgMapping =

    SUMMARIZE(

        Sheet1,

        Sheet1[AltOrgCodes],

        Sheet1[OrgAbbreviated]

    )

     

    Next, create a table disconnected from your data model for the AltOrgCodes. Example:

    AltOrgCodeSlicer =

    DISTINCT(AltOrgMapping[AltOrgCodes])

     

    Then, create a measure to determine whether each row in your data matches the OrgAbbreviated tied to the selected AltOrgCode. Example:

    ShowRelatedAltOrgCodes =

    VAR SelectedCode = SELECTEDVALUE(AltOrgCodeSlicer[AltOrgCodes])

    VAR SelectedOrg =

        CALCULATE(

            MAX(AltOrgMapping[OrgAbbreviated]),

            AltOrgMapping[AltOrgCodes] = SelectedCode

        )

    RETURN

        IF(

            MAX(Sheet1[OrgAbbreviated]) = SelectedOrg,

            1,

            0

        )

     

    Use the AltOrgCodeSlicer[AltOrgCodes] column in your slicer and apply the ShowRelatedAltOrgCodes measure as a visual-level filter set to 1. This will ensure that when one AltOrgCode is selected, all rows with the same OrgAbbreviated and their corresponding AltOrgCodes are shown.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.