Forum Discussion

project101's avatar
project101
Frequent Visitor
4 years ago

Running Sum with filter slicer problem m - query

using Running Sum in m- query  have better   performance than dax exp
the only problem is using slicer  like dates 
we gat the base values of rt 
is not Recalculationthen the values after filter
??
the function 
= (val as list ) as list =>
let
dd=List.Generate(
()=>[ xx =0 , zz=val{0} ],
each [xx] <=List.Count(val) ,
each [ xx=[xx]+1 , zz = [zz] + val{ [xx]+1 } ] , each [zz]

) in dd


and then
Table.FromColumns(

{ aaa[n] ,aaa [val] , fxRunTotal(aaa[val]) }

4 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Not totally clear on your scenario, but columns created either with the query editor or with a DAX expressions will not respond slicers.  They calculated only when the data model is refreshed.  You need to write measures to get filtering by slicers.

     

    Pat

     

    • project101's avatar
      project101
      Frequent Visitor

      tanks for your answer
      very simple 
      microsoft in quick measure runningsum sample is very very slow for amount of records  
      Because for every  row is  recalculate from start to current row
      better approach is to run index like idx=idx+1 like while loop 

      im m query you can use it in List.Generate by passing list column paramter from you table

      the problem i in  filtering data

      the rt start from the base value unlike dax exp 

      {1,2,3,4,5} list for filtering the number 5 the rt exp will be 10 instead  5

      this is the value that we need in m - query before the exp dax

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        There may be a more optimized way to write your DAX measure, so you may want to share that.  For the M solution, can you provide a small sample table that shows your desired output.

         

        Pat