Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic card value based on other visuals

I'm currently working on a report that has a shape map, a matrix and a card. The card displays the region that has been selected on the map. The table shows companies. I am needing the card to update based on whether one of the other visuals is interacted with, like so:

 

1. If nothing is selected (ie. nothing in the matrix is selected and no region on the map is selected) then the card reads "All"

2. If a region is selected then the card displays the name of the region.

3. If multiple regions are selected on the map or a company that is present in multiple regions is selected in the matrix, then the card reads "Multiple".

 

I have the following measure:

 

RegionSelector = IF(ISFILTERED('Exemptions Data'[Planning Regions]), SELECTEDVALUE('Exemptions Data'[Planning Regions], "Multiple"), "All")
 
This works for the map as in the numbered steps above but if I select a company in the matrix then the card will display "All" regardless of whether the company is present in 0, 1, or multiple regions.
 
Any help would be appreciated.
Thanks!

 

  • Hi Anonymous ,

    You can try this measure:

    Measure =
    VAR y =
        CALCULATE ( DISTINCTCOUNT ( 'Table'[Region] ), ALLSELECTED ( 'Table' ) )
    VAR x =
        IF (
            NOT ISFILTERED ( 'Table'[Region] ) && NOT ISFILTERED ( 'Table'[Company] ),
            "All",
            IF (
                HASONEVALUE ( 'Table'[Region] ),
                VALUES ( 'Table'[Region] ),
                IF ( y > 1, "Multiple" )
            )
        )
    RETURN
        x

    nothing is selected

    one region is selectedcompany in multi regionsselect multi regions

     

    Sample file is attached that hopes to help you, please check and try it: Dynamic card value based on other visuals.pbix 

     

    Best Regards,
    Yingjie Li

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

1 Reply

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    You can try this measure:

    Measure =
    VAR y =
        CALCULATE ( DISTINCTCOUNT ( 'Table'[Region] ), ALLSELECTED ( 'Table' ) )
    VAR x =
        IF (
            NOT ISFILTERED ( 'Table'[Region] ) && NOT ISFILTERED ( 'Table'[Company] ),
            "All",
            IF (
                HASONEVALUE ( 'Table'[Region] ),
                VALUES ( 'Table'[Region] ),
                IF ( y > 1, "Multiple" )
            )
        )
    RETURN
        x

    nothing is selected

    one region is selectedcompany in multi regionsselect multi regions

     

    Sample file is attached that hopes to help you, please check and try it: Dynamic card value based on other visuals.pbix 

     

    Best Regards,
    Yingjie Li

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