Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Display empty if another value is equal to a specific value

Hi guys,

 

I have a data table like below

 

and I would like to display a table with the result like this 

In fact, when C = YES, I must display empty in A and B. 

My solutions requires a creation of a column in the data model and in order to optimize the performance I would like to do it with Dax language. Do you think it's possible ?

 

Thank you !

  • Hi Anonymous ,

     

    You can create a measure like below:-

     

     

    _A = IF(MAX('Table (3)'[C]) = "Yes",BLANK(),MAX('Table (3)'[A]))
    _B = IF(MAX('Table (3)'[C]) = "Yes",BLANK(),MAX('Table (3)'[B]))

     

     

    Enable "Show item with no data"

     

     

     

    Output:-

     

     

    Thanks,

    Samarth

     

3 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

     

    You can create a measure like below:-

     

     

    _A = IF(MAX('Table (3)'[C]) = "Yes",BLANK(),MAX('Table (3)'[A]))
    _B = IF(MAX('Table (3)'[C]) = "Yes",BLANK(),MAX('Table (3)'[B]))

     

     

    Enable "Show item with no data"

     

     

     

    Output:-

     

     

    Thanks,

    Samarth

     

  • HI Anonymous ,

     

    You can just create 2 columns in Power BI - one for A and the other one for B.

    newA = IF(yourtable[C] = "YES", "", yourtable[A])
    newB = IF(yourtable[C] = "YES", "", yourtable[B])

     Replace yourtable with your actual table name in the above DAX expressions.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you ! 

      That's what I have already done but I wondered if it's possible with a measure