Forum Discussion

Turka89's avatar
Turka89
Helper I
6 years ago

if this column equal these values

Hi,

 

I have this scenario, if this column equals these values then show the result. However, there is a blank entry of which I want it deleted. Here is the DAX

 

column = IF(REQUISITION[Division] IN {"IT", "HR"}, REQUISITION[Division])
 
 
I tried function ISBLANK and first row result in true others are false. how do I remove it with DAX
 
Thank you so much

5 Replies

  • Turka89 use filter or add a measure and display in the visual

     

    measure = IF(MAX(REQUISITION[Division]) IN {"IT", "HR"}, MAX(REQUISITION[Division])

     

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

     

     

    • Turka89's avatar
      Turka89
      Helper I

      Hi parry2k 

       

      Now only shows the blank entry when I use Max. It seems that when I spcifically chose values and I left other values will result in blank entry

       

      Is there another way to do what I'm trying to achieve without IF statement?

       

      Thank you so much 

      • parry2k's avatar
        parry2k
        Super User

        Turka89 not fully sure and understood. Can you paste the data in table format so that I can download and also expected results.

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Turka89 

     

    Based on your description, I created data to reproduce your scenario.

    REQUISITION:

     

    You may try the following two ways.

    Way one:

    You may create a calculated column and a measure as below.

     

    Calculated column:
    Result Column = 
    IF(
        REQUISITION[Division] in {"IT","HR"},
        REQUISITION[Division]
    )
    
    Measure:
    IsDisplay = 
    IF(
        NOT(ISBLANK(SELECTEDVALUE(REQUISITION[Result Column]))),
        1,
        0
    )

     

     

    Then you need to put the measure in the visual level filter to display the result.

     

    Way two:

    You may create a measure as below.

     

    Result Measure = 
    IF(
        SELECTEDVALUE(REQUISITION[Division]) in {"IT","HR"},
        SELECTEDVALUE(REQUISITION[Division])
    )

     

     

    Result:

     

    If I misunderstand your thoughts, please show us your sample data and expected result with OneDrive for business. Do mask sensitive data before uploading.

     

    Best Regards

    Allan

     

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

  • @Hi parry2k v-alq-msft ,

     

    First of all Im sorry I haven't explained what I'm trying to achieve here clearly. I was traying to extract few values/rows off column Division and display it in a new calculated column alone.

     

    I do not want to display two cloumns with the same values such as v-alq-msft tried to do. I do only want to display one column Divison/Result

     

    Filter works great on visual level and did removed the blank entry but I was hoping is to do a DAX that will remove the blank entry without doing any filtering on any visual-level.

     

    parry2k 

     

    Using your DAX creating a measure with MAX and use it along with Division being displayed/used will indeed remove the blank entry but both columns are displayed 

     

    Otherwise If I only use/display your DAX measure will only display the blank entry but no Divison values.

     

    v-alq-msft 

     

    I liked the measure you created which will remove the blank entry if you set condition to 1 on visual-level filter. I have tried it and worked like a charm. However, SelectedValue method resulted the exact result as using MAX which shows only blank entry but no Division values. 

     

    So both method MAX and SELECTEDVALUE only show results when division is used/displayed as well. Why is that?  

     

    Thank you so much both for your inputs I was able however to acheive the wanted result via Filter and IsDisplat on visule-level