Forum Discussion

UKNSI-Powerbi's avatar
UKNSI-Powerbi
Frequent Visitor
3 years ago

Row variance calculation

Hi,

 

We have a table and we hope to be able to calcuate row. variance. 

 

Example 

Dec 20 Variance between 15/12 (480) and 01/12 (432) is (480-432)/432 = 11%

 
DateRefRevDec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21 Var DecVar JanVar FebVar MarVar AprVar MayVar Jun
01/12/202065043281612721872232827883006        
15/12/202073048081613202040254429823220 11% 4%9%9%7%7%
18/12/2020760 81613202040254429823220        
02/01/2021770 81613202040254429823220        
12/01/2021850 3369121680225628023096  -59%-31%-18%-11%-6%-4%
26/01/2021890 3369361752230428023142   3%4%2% 1%
01/02/2021900  9361752230428283142  -100%   1% 
15/02/2021990  10321824234028343123   10%4%2%0%-1%
26/02/20211050   1896249629563264    4%7%4%5%
01/03/20211060   1944259230523360    3%4%3%3%
15/03/20211140   1800245230323390    -7%-5%-1%1%
30/03/20211220   1992254430443510    11%4%0%4%

 

Thanks everyone can help with it

2 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi UKNSI-Powerbi 

     

    Does your current data table have the format as you have shown? If so, you can add new columns to the table with below DAX. You just need to modify the column name and the value column it references. 

    Var Dec = 
    var _date = MAXX(FILTER('Table','Table'[Date]<EARLIER('Table'[Date])),'Table'[Date])
    var _value = MAXX(FILTER('Table','Table'[Date]=_date),'Table'[Dec-20])
    return
    DIVIDE('Table'[Dec-20]-_value,_value)

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!

  • UKNSI-Powerbi's avatar
    UKNSI-Powerbi
    Frequent Visitor

    Hi v-jingzhang 

     

    It seems my post need further details.

     

    At the moment I have a table of customer cumulations grouped by  Cust/Seq/Contract/Part/Date/Release/YYYYMM

     

    CustSeqContractPartDateReleaseRevYYYYMMCUMULATION
    CUST1    10035987PART1    01/12/2020650202012432
    CUST1    10035987PART1    02/12/2020660202012432
    CUST1    10035987PART1    03/12/2020670202012424
    CUST1    10035987PART1    07/12/2020680202012424
    CUST1    10035987PART1    08/12/2020690202012432
    CUST1    10035987PART1    09/12/2020700202012480
    CUST1    10035987PART1    10/12/2020710202012480
    CUST1    10035987PART1    15/12/2020720202012480
    CUST1    10035987PART1    16/12/2020730202012480
    CUST1    10035987PART1    01/12/2020650202101816
    CUST1    10035987PART1    02/12/2020660202101816
    CUST1    10035987PART1    03/12/2020670202101808
    CUST1    10035987PART1    07/12/2020680202101808
    CUST1    10035987PART1    08/12/2020690202101816
    CUST1    10035987PART1    09/12/2020700202101888
    CUST1    10035987PART1    10/12/2020710202101888
    CUST1    10035987PART1    15/12/2020720202101888
    CUST1    10035987PART1    16/12/2020730202101816
    CUST1    10035987PART1    17/12/2020740202101816
    CUST1    10035987PART1    17/12/2020750202101

    816

     

    On PBI the matrix is looking like this

     

     

    I would like to be able to calculate the variance in PBI for the same group Cust/Seq/Contract/Part/Date/Release/YYYYMM day by day.

     

    Example 

    CustSeqContractPartDateReleaseRevYYYYMMCUMULATIONVariance
    CUST1    10035987PART1    01/12/2020650202012432 
    CUST1    10035987PART1    02/12/20206602020124320%
    CUST1    10035987PART1    03/12/2020670202012424-2%
    CUST1    10035987PART1    07/12/20206802020124240%
    CUST1    10035987PART1    08/12/20206902020124322%
    CUST1    10035987PART1    09/12/202070020201248011%
    CUST1    10035987PART1    10/12/20207102020124800%
    CUST1    10035987PART1    15/12/20207202020124800%
    CUST1    10035987PART1    16/12/20207302020124800%
    CUST1    10035987PART1    01/12/202065020210181670%
    CUST1    10035987PART1    02/12/20206602021018160%
    CUST1    10035987PART1    03/12/2020670202101808-1%
    CUST1    10035987PART1    07/12/20206802021018080%
    CUST1    10035987PART1    08/12/20206902021018161%
    CUST1    10035987PART1    09/12/20207002021018889%
    CUST1    10035987PART1    10/12/20207102021018880%
    CUST1    10035987PART1    15/12/20207202021018880%
    CUST1    10035987PART1    16/12/2020730202101816-8%
    CUST1    10035987PART1    17/12/20207402021018160%
    CUST1    10035987PART1    17/12/20207502021018160%

     

    Your help will be really appreciate.

    Thanks 

    Joe