Forum Discussion

Zakaria_1980's avatar
Zakaria_1980
Icon for Post Patron rankPost Patron
4 years ago
Solved

Get blank() as output

Hi,

 

I've DB with Target for each module and how many achieved per City. so when I want to get the gap for each Module and per city, if in the DB in one of the cities, one of the modules was not forecasted to be done, i get blank() as output. how can i change that to N/A please?

 

 

Thanks

 

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Zakaria_1980 ,

     

    It looks like a matrix. But you chose a card visual, which is puzzling.

     

    You can use the matrix visual to show the same effect.

     

     

     

    Here's the solution.

    1.Does your data model only have one table?

    If it is, use dax to create a Module table.

    Table 2 = DISTINCT('Table'[Module])

     

    2.Relationship is as follows.

     

    3.Create two measures.

    Target value = 
    var _sum=SUM('Table'[Target])
    return
    IF(ISBLANK(_sum),"N/A",_sum)
    Acieved value = 
    var _sum=SUM('Table'[Achieved])
    return
    IF(ISBLANK(_sum),"N/A",_sum)

     

    Then we get the results.

     

    Check the attachment for more details.

     

     

    Best Regards,

    Stephen Tao

     

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

12 Replies

  • Hi Zakaria_1980 ,

     

    You haven't shared any sample data here, so you can create a calculated column using following DAX:

    IF(ISBLANK(yourTable[Column]), "N/A", yourTable[Column])

    Replace yourtable and Column with your table name and column name.

     

    Thanks,

    Pragati

  • I simplified the DB as follow:

    CityModuleTargetAchieved
    City#1Module#1107
    City#1Module#2105
    City#1Module#3108
    City#1Module#42016
    City#1Module#54530
    City#2Module#12620
    City#2Module#220
    City#2Module#387
    City#2Module#53612

     

     

    the output that I've is as follow.

    if i select in the filter City#1, i've the following:

     

     Module#1Module#2Module#3Module#4Module#5
    Target1010102045
    Achieved7581630

     

    and if i select the City#2, i've the following:

     

     Module#1Module#2Module#3Module#4Module#5
    Target2628Blank()36
    Achieved2007Blank()12

     

    what i need is that replace that blank() by N/A, please if you could implement this in Power bi desktop and share it with me.

     

    thx

     

  • yes but it doesn't work, that's why i shared with you the DB how it looks like.

    please have a look at it.

     

    thx

     

    • Pragati11's avatar
      Pragati11
      Icon for Super User rankSuper User

      HI Zakaria_1980 ,

       

      Just curious to know. what visual is this?

      Is it a table/matrix visual? I am not able to replicate this at my end. When I try to bring element as follows on a report page in Power BI:

       Now when I start using slicer, I don't see any blanks at my end.

      So now my next question is. Have you got any relationships going on in Power BI with this table?

       

      Thanks,

      Pragati

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Zakaria_1980 ,

     

    It looks like a matrix. But you chose a card visual, which is puzzling.

     

    You can use the matrix visual to show the same effect.

     

     

     

    Here's the solution.

    1.Does your data model only have one table?

    If it is, use dax to create a Module table.

    Table 2 = DISTINCT('Table'[Module])

     

    2.Relationship is as follows.

     

    3.Create two measures.

    Target value = 
    var _sum=SUM('Table'[Target])
    return
    IF(ISBLANK(_sum),"N/A",_sum)
    Acieved value = 
    var _sum=SUM('Table'[Achieved])
    return
    IF(ISBLANK(_sum),"N/A",_sum)

     

    Then we get the results.

     

    Check the attachment for more details.

     

     

    Best Regards,

    Stephen Tao

     

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