Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Growth Percentage Line

i dont want to see 2024 growth line in 2022 what condition i can put it to make 0 for 2022 or to get correct growth line for 2024 compare to 2022 as well 
like we can use sameperiod last year function for 1 year something like this please help me out 
thanks and regards,
Sumit Dubey

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Please have a try. Create a measure.

    Growth Percentage 2024 =
    VAR CurrentYear =
        YEAR ( TODAY () )
    VAR BaseYear = 2022
    VAR TargetYear = 2024
    VAR BaseValue =
        CALCULATE (
            SUM ( YourDataTable[YourValueColumn] ),
            YEAR ( YourDataTable[YourDateColumn] ) = BaseYear
        )
    VAR TargetValue =
        CALCULATE (
            SUM ( YourDataTable[YourValueColumn] ),
            YEAR ( YourDataTable[YourDateColumn] ) = TargetYear
        )
    RETURN
        IF (
            CurrentYear = BaseYear,
            BLANK (),
            // This will make the growth line 0 or blank for the base year (2022)
            IF (
                CurrentYear = TargetYear,
                ( TargetValue - BaseValue ) / BaseValue,
                BLANK () // This will also make the growth line 0 or blank for years other than the target year (2024)
            )
        )
    

     I ahve also found a similar post, please refer to it to see if it helps you.

    powerbi desktop - how to compute the growth rate in Power Bi using Dax? - Stack Overflow

     

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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

     

     

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please have a try. Create a measure.

    Growth Percentage 2024 =
    VAR CurrentYear =
        YEAR ( TODAY () )
    VAR BaseYear = 2022
    VAR TargetYear = 2024
    VAR BaseValue =
        CALCULATE (
            SUM ( YourDataTable[YourValueColumn] ),
            YEAR ( YourDataTable[YourDateColumn] ) = BaseYear
        )
    VAR TargetValue =
        CALCULATE (
            SUM ( YourDataTable[YourValueColumn] ),
            YEAR ( YourDataTable[YourDateColumn] ) = TargetYear
        )
    RETURN
        IF (
            CurrentYear = BaseYear,
            BLANK (),
            // This will make the growth line 0 or blank for the base year (2022)
            IF (
                CurrentYear = TargetYear,
                ( TargetValue - BaseValue ) / BaseValue,
                BLANK () // This will also make the growth line 0 or blank for years other than the target year (2024)
            )
        )
    

     I ahve also found a similar post, please refer to it to see if it helps you.

    powerbi desktop - how to compute the growth rate in Power Bi using Dax? - Stack Overflow

     

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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