Forum Discussion

noble10's avatar
noble10
Frequent Visitor
5 years ago

How to show specific value

I would appericate it if someone can help me. 

 

How do I create a DAX formula to only show specific value. 

For example, I would like to create a Dax formula to only show branch 19, 22, 27 and exclude the rest of the branch. I do not want to use the exclude using the filter. 

 

 

8 Replies

  • Hi noble10 

     

    Please try this measure:

    Filtered Branch = 
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[Location Name], "" ),
        FILTER ( 'Table', 'Table'[Branch] IN { 19, 22, 27 } )
    )

     

    the output will be as below:

     

    Did I answer your question? Mark my post as a solution!

    Appreciate your Kudos  !!

    • noble10's avatar
      noble10
      Frequent Visitor

      Hi VahidDM, 

       

      Thank you so much for your help! I unfortunately was not able to select the measure as a slicer. Not sure why? 

      • VahidDM's avatar
        VahidDM
        Super User

        Hi noble10

        Try to add a column with this code to your table:

        IF you want to have Branch No. in your slicer:

        Filtered Branch = if('Table'[Branch] in{19,22,21},'Table'[Branch])

         

        If you want to have a Location Name in your slicer:

        Filtered Branch = if('Table'[Branch] in{19,22,21},'Table'[Location Name]) 

         

        Then add Filtered Branch column to your slicer.

         

        Did I answer your question? Mark my post as a solution!

        Appreciate your Kudos  !!

         

         

         

         

         

         

  • Hi noble10 

     

    Could you please share a screenshot from the error you ean into here? or share the sample of your PBIX (power bi) file here to be able to work on it.

     

    Appreciate your Kudos  !!

    • noble10's avatar
      noble10
      Frequent Visitor

      Hi VahidDM  

       

      I message you the link to the PBIX (power BI) file. Thank you. 

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    you can add a IF function in your measures, such as 

     

    IF(SELECTEDVALUE(table[Branch]) IN {19,22,27},[old measure])

    • noble10's avatar
      noble10
      Frequent Visitor

      Hi wdx223_Daniel  

       

      I tried that and it doesn't seem to work either.  

      I was unable to generate a slicer after creating the measure.