Forum Discussion

netanel's avatar
netanel
Post Prodigy
2 years ago
Solved

calculate with diffrent types

Hi All, I need your help in this case, I have this measure that combines different values with two different types percentage and whole number. Combined_Measure =     SWITCH (         TRUE (), ...
  • netanel's avatar
    netanel
    2 years ago
    Hi thanks but
    I found the solution 
    I just wrapped the measure separately with the following adjustments:
    Prior Year % =
    VAR SumLast6Months = [Combined Measures | Sum Last 6 Months]
    VAR SumLast6MonthsLastYear = [Combined Measures | Sum Last Year]


    VAR NoDataAvailable = ISBLANK(SumLast6Months) || SumLast6Months = "" || ISBLANK(SumLast6MonthsLastYear) || SumLast6MonthsLastYear = ""


    VAR SumLast6MonthsNumeric = IF(RIGHT(SumLast6Months, 1) = "%", VALUE(LEFT(SumLast6Months, LEN(SumLast6Months) - 1)) / 100, SumLast6Months)
    VAR SumLast6MonthsLastYearNumeric = IF(RIGHT(SumLast6MonthsLastYear, 1) = "%", VALUE(LEFT(SumLast6MonthsLastYear, LEN(SumLast6MonthsLastYear) - 1)) / 100, SumLast6MonthsLastYear)


    VAR PercentageChange = DIVIDE(SumLast6MonthsNumeric, SumLast6MonthsLastYearNumeric) - 1

    RETURN
        IF (
            NoDataAvailable,
            BLANK(),  
            FORMAT(PercentageChange, "0.00%")  
        )