Forum Discussion

brockry1's avatar
brockry1
Helper II
1 year ago
Solved

Growth % DAX Command

I'm trying to place a conidional DAX formula to show if the prior year is 0 then show 100% growth other wise divide the current year/prior year -1.  

 

When I add the clause "If(Prior Year) isblank,1, 

if prior year>0, divide current year/prior year-1

 

this is giving me a "False" return and not showing the cell as 100%.

 

Current formula is "

Growth = IF([Prior Year]>0,

(DIVIDE([Current Year]-[Prior Year],[Prior Year])))
 
and shows this
 

 

 

Need blank cell to show 100%...what am I doing wrong? 

  • Growth % =
    IF(
            OR(
                [Prior Year] > 0,
                ISBLANK([Prior Year])
            ),
     
            DIVIDE(
                [Current Year] - [Prior Year],
                [Prior Year],
                1
            )
        )
     

6 Replies

  • hi brockry1 

     although you can simply add 1 at the end of your current formula

    Growth = IF([Prior Year]>0(DIVIDE([Current Year]-[Prior Year],[Prior Year])),1)
     or
    add +0 at the end of your prior calculation, and define the condition based on zero.
     
    If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.
    • brockry1's avatar
      brockry1
      Helper II

      It solves for the prior year of 0 equaling 100% however it sorts and shows all the addresses as the same and this isn't true:  See screen shot:

       

       

      • FreemanZ's avatar
        FreemanZ
        Super User

        hi brockry1 ,

         

        that might be another issue. can you tell more about your data model, and the code for the two measures, [Current Year] and [Prior Year]?

  • Growth % =
    IF(
            OR(
                [Prior Year] > 0,
                ISBLANK([Prior Year])
            ),
     
            DIVIDE(
                [Current Year] - [Prior Year],
                [Prior Year],
                1
            )
        )