Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
noble10
Frequent Visitor

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. 

 

noble10_0-1629925280785.png

 

8 REPLIES 8
wdx223_Daniel
Super User
Super User

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

 

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

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. 

 

noble10_1-1630424420209.png

 

noble10_0-1630424361807.png

 

VahidDM
Super User
Super User

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 VahidDM_0-1630367480968.png !!

Hi @VahidDM  

 

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

VahidDM
Super User
Super User

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:

VahidDM_0-1629941461894.png

 

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

Appreciate your Kudos VahidDM_1-1629941471047.png !!

Hi VahidDM, 

 

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

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 VahidDM_0-1630022811680.png !!

 

 

 

 

 

 

Hi @VahidDM  

 

I tried the instruction above but it dosen't seem to work. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors