Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Replacing Blanks with 0 - Adding +0/ creating a new measure not working!

Hello, 

 

I have been trying to replace Blank values as 0 in my matrix visualisation. I have tried using +0 in a new measure and dax functions but no luck. Below is an example of my data and what i am trying to do. Please share your ideas!!

 

DirectionCategoryDate
I117-Jun
B218-Jun
B317-Jun
I118-Jun
I220-Jun
I421-Jun
B519-Jun

I am trying to add values as "0" when the count of category for a specific date is null. 

 

Thanks in advance!

8 Replies

  • dm-p's avatar
    dm-p
    Icon for Super User rankSuper User

    Hi Anonymous,

    This is probably a better question to ask in the DAX forum - there's a lot of skilled DAX writers who don't frequent the custom visuals forum, and the DAX forum has a lot more traffic, so it's likely you'll get faster, more targeted assistance.

    I can take a look though - can you provide the DAX you're using for your measure, and some information about the fields you're using? I would expect the following to work:

    [Count] = COUNT([Category]) + 0

    I've just tested this in a matrix where I actually want the opposite to happen, and all blanks are replaced with zeroes, as expected.

    If this (or similar) is not working for you then it suggests that there may be an issue with your model or one of the fields you're adding to the matrix, so if you can provide this info then we might be able to dig a bit deeper.

    Daniel

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi dm-p,

       

      Thank you, i will also share the post under DAX Forum. 

       

      I have used the following dax:

       

      count = count([category]) + 0

      count = if(isblank(count([category)),0,count([category]))

      Child Count = 
      VAR rowcount =
          COUNTROWS ( Child )
      RETURN
          IF ( rowcount = BLANK (), 0, rowcount )​
      count of category = IF(COUNTX(VCCdata,VCCdata[Category]) = 0, 0, COUNT(VCCdata[Category]))
      ActualM =
      IF (
          CALCULATE ( SUM ( Expenses[Actual] ) ) = BLANK (),
          0,
          CALCULATE ( SUM ( Expenses[Actual] ) )
      )
      • dm-p's avatar
        dm-p
        Icon for Super User rankSuper User

        Hi Anonymous,

        Thanks - without further knowledge of your data/model I would expect any of those to work, so I think you'll definitely get better assistance in the other forum, particualary if you can share some more info around this.

        Good luck!

        Daniel