Forum Discussion

JoeKulasa's avatar
JoeKulasa
Regular Visitor
5 years ago
Solved

Running Total based on Separate Calculation

Hello,

 

I am looking to create a column that creates a running total based on another calculated column.  I want the running total to capture the sum of the column "Difference", and reset everytime there's a new shift introduced.  Screenshot below for how I've tried to use the variable.  I've also included how the "Difference" column is calculated.

 

 

 

 

  • Hi  JoeKulasa 

    You could use the following measure:

    Difference2= if(HASONEVALUE('CPM 21'[shift]),[difference],sumx(ALL('CPM 21'),'CPM 21'[difference]))

    Due to without your pbix file ,so I use my data as a sample,the below,[onemon] is a mesaure,so the number total is incorrect:

     then use the following measure:

    Jan = IF(HASONEVALUE('Table'[MATERIAL]),[onemon], SUMX(ALL('Table'),'Table'[onemon]))

    Final get what I want!

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien

3 Replies

  • JoeKulasa , Try a measure like

    calculate(sum('CPM 21'[difference]) , filter(allselected('CPM 21'), 'CPM 21'[Day] <= max('CPM 21'[Day])))

    • JoeKulasa's avatar
      JoeKulasa
      Regular Visitor

      amitchandak Thanks for the suggestion.  No luck yet - I used your suggestion as a column and a measure and here are the results. Note the "Shift" reset does appear to work, but it looks like it's aggregating on the shift as opposed to created a running total.

       

       

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi  JoeKulasa 

    You could use the following measure:

    Difference2= if(HASONEVALUE('CPM 21'[shift]),[difference],sumx(ALL('CPM 21'),'CPM 21'[difference]))

    Due to without your pbix file ,so I use my data as a sample,the below,[onemon] is a mesaure,so the number total is incorrect:

     then use the following measure:

    Jan = IF(HASONEVALUE('Table'[MATERIAL]),[onemon], SUMX(ALL('Table'),'Table'[onemon]))

    Final get what I want!

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien