Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Require a Slicer for Data Output

I have userd Power BI, with reasonable success, to create a directory for my organization.  As an example, a user selects a "Market", and below I have cards showing Address, Phone, Local Staff and Corporate Contacts.

 

I am trying to force a rule that the the slicer where a user selects a specific market must be selected to show data on the cards below.  Is there a DAX statement that I can use that require a user to select an option from the slicer, to "reveal" the supporting details.

 

Thanks in adavance!

  • Sorry again ... another mistake ... Forget my previous message.

     

    Address1 = IF(HASONEVALUE(Sheet1[Market]),  VALUES(Sheet1[Address 2]), BLANK() )

    Vicente

12 Replies

  • Hi irnm8dn

     

    What about ....

     

    IF(HASONEVALUE(SlicerTable[SlicerField]), [Measure], BLANK())

    Where ...

    SlicerTable is the table where the slicer comes from,

    SlicerField is the slicer

    and

    [Measure] is the result to be shown in the card

    I think that's what you need

    Vicente

    • Anonymous's avatar
      Anonymous
      Not applicable

      vcastello

       

      I think we are onto something.

       

      In this case I am using two tables:

      • Lat & Long
      • Sheet 1

      The slicer is "Market"

      The Card Output is "Address 2" (for the card below that shows Address)

       

      Both elements are from "Sheet 1".

       

      Can you write the DAX statment based on this information, as I can't seem to get it to work properly.
       

      Couple of questions:

       

      1.  Are we creating a Measure or a Column?

      2.  Do I need to create a Measure/Column for each of the cards?  (See image below)

      3.  Once created, how do I apply to the cards?

       

      • vcastello's avatar
        vcastello
        Icon for Resolver III rankResolver III

        Hi,

         

        I think something is missing. As I have understood ...

        1.- You have a table named "Lat&Long"
        2.- You have a table named "Sheet 1"
        3.- In the table named "Sheet 1" you have a column named "Market"
        4.- In the table named "Sheet 1" you have a column named "Address 2"
        5.- In the table named "Sheet 1" you have other columns (phone, corporate contacts, etc).

        Now ... 

        A.- Do you have the measure that shows the value of Address 2?
           1.- If you don't, you obviously need it for showing the address. I don't know exactly how your data model is, but it should be                something like ...
                         
                                  Address = VALUES(Sheet1[Address 2])
           

           2.- If you do ... you have to rewrite it including the IF(HASONEVALUE( ... wrapper. Something like ....

                                    IF(HASONEVALUE('Sheet 1'[Market]), [Address], BLANK() )
               
                   Where [Address] is the measure you already have.
         
        What this wrapper does is force the measure to be shown ONLY if there is a value in market (the slicer). 

        B.- Obviously you will need to place a slicer in the canvas in order to slice the cards. This slicer should be filled with the 'Sheet 1' [Market] Column.

        B.- Your questions ....

           1.- We are creating a measure that has to show the values of the "Address2"  column (and all the other columns you want in the canvas).
        2.- Yes. You have to create a measure for each of the columns you want to show.
        3.- Create the visual through the panel, selecting the one that corresponds to the card. Then you should drop the measure you have created into the Fields box.