Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Calculate the difference between two closest date, and significance difference

I would like to calculate the score difference between the lastest score and its closest past score of the same Name, and then show the difference by show the green up, red down and no change symbol. Also, I would like to test whether the change has a significant change in the difference when comparing it, and show it as a filled circle and non-filled circle. Below is the small sample data.

 

 

IDName ScoreDate
1A71/9/2022
2B83/9/2022
3C95/9/2022
4A611/9/2022
5B818/9/2022
6C419/9/2022
7A920/9/2022
8A1021/9/2022
9B622/9/2022
10C1024/9/2022

 

4 Replies

  • Hi,

    I tried to create something like below.

    When searching for UNICHAR symbols, I could not find what you want, but I hope you can find ones.

    Please check the below picture and the attached pbix file.

    I hope the below can provide some ideas on how to create a solution for your actual data model.

    All measures are in the attached pbix file.

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      What I mean significance here is testing the statistically significance difference, which mean i have to use the one-tailed t-test

  • Anonymous , A new column

     

    var _date= maxx(filter(Table, [Name] = earlier([Name]) && [Date] < earlier([Date]) ), [Date])

    return

    [score]- maxx(filter(Table, [Name] = earlier([Name]) && [Date] =_date ), [score]) 

     

    or a measure

     

    anew meausre =

     

    var _date= maxx(filter(allselected(Table) , [Name] = max([Name]) && [Date] < max([Date]) ), [Date])

    return

    max([score]) - maxx(filter(Table, [Name] = max([Name]) && [Date] =_date ), [score]) 

     

    or

     

    sum measure

     

    var _date= maxx(filter(allselected(Table) , [Name] = max([Name]) && [Date] < max([Date]) ), [Date])

    return

    sum([score]) - sumxx(filter(Table, [Name] = max([Name]) && [Date] =_date ), [score]) 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for you reply. Do you also know how to solve the same problem but changed to the below tables? Many thanks.

       

      IndexName IDQuestionDate
      1A1Q1_A11/9/2022
      2A2Q1_A23/9/2022
      3C1Q1_A55/9/2022
      4A3Q1_A411/9/2022
      5B1Q1_A218/9/2022
      6C2Q1_A319/9/2022
      7A4Q1_A320/9/2022
      8A5Q1_A221/9/2022
      9B2Q1_Q122/9/2022
      10C3Q1_A124/9/2022
      Q & Ans no.Score
      Q1_A110
      Q1_A28
      Q1_A35
      Q1_A42
      Q1_A50