Forum Discussion

newgirl's avatar
newgirl
Post Patron
3 years ago
Solved

Basic equation in DAX displays incorrectly

Hello!

 

In this report I'm developing, I've created lots of initial measures. The next measure I need is to capture the simple formula from this Excel report:

=IF(D23*D22=0,1,D23*D22)

 

I tried to replicate it in PBI using this formula:

Pack1_OperEff = 
IF(ISBLANK([Pack1_MachEff]*[Pack1_OperUtil]),1,[Pack1_MachEff]*[Pack1_OperUtil])

but the matrix goes wacko

 

 

However, if I use blank instead of 1, the matrix is okay.

Pack1_OperEff = 
IF(ISBLANK([Pack1_MachEff]*[Pack1_OperUtil]),BLANK(),[Pack1_MachEff]*[Pack1_OperUtil])

 

How do I fix my measure? And can somebody explain this "phenomenon"  so I would know how to handle it next time?

  • Hi,

     

    For all of the dates in your date table where there are no data, your measure returns 1. Thats "normal" and correct.

     

    Just add

     

    IF(
         NOT(ISBLANK([Pack4_ActualCap])),
         yourCode
    )

     

     

    I used Pack4_ActualCap as an example. Just replace by any measure where you are certain that there are data for the specific dates.

     

    BR

     

     

     

     

     

     

     

3 Replies

  • lukiz84's avatar
    lukiz84
    Memorable Member

    Hi,

     

    For all of the dates in your date table where there are no data, your measure returns 1. Thats "normal" and correct.

     

    Just add

     

    IF(
         NOT(ISBLANK([Pack4_ActualCap])),
         yourCode
    )

     

     

    I used Pack4_ActualCap as an example. Just replace by any measure where you are certain that there are data for the specific dates.

     

    BR

     

     

     

     

     

     

     

    • newgirl's avatar
      newgirl
      Post Patron

      Hello lukiz84 ! Thanks for the reply, I understand now the "phenomenon". I adjusted my measure a bit based on your explanation

      Pack1_OperEff = 
      IF(
          (ISBLANK([EquipNominalCap])),
          BLANK(),IF(ISBLANK([Pack1_MachEff]*[Pack1_OperUtil]),1,[Pack1_MachEff]*[Pack1_OperUtil]))
      • lukiz84's avatar
        lukiz84
        Memorable Member

        So does it work now? If so, then I'm glad i could help. Could you mark my answer as the solution?