Forum Discussion

TomF1212's avatar
TomF1212
Copper Contributor
Aug 06, 2022
Solved

Monetary unit sampling - Power Query

Hello community,

 

I would very much appreciate any help. I'm trying to create dynamic MUS report (monetary unit sampling). I need to filter each line in Excel (in attachment as Source table) that exceeds certain amount (Criteria) of accumulated value (in example Accumulation) and create a report only with this lines (in attachment as Report table). Is there a way to do it? So I need to filter all lines for which accumulation exceeds 150 in my case.

    • Chris1979's avatar
      Chris1979
      Copper Contributor

      OliverScheurich 

       

      Hello,

      I have a similar problem, how to do a MUS report (monetary unit sampling) in power query.
      however, I have to add a random variable.
      therefore I would like to prepare the report in a different way. Below I present how I did it in EXCEL.
      please help me translate this into POWER QUERY.

       

      thank you in advance

       

      Formulas in EXCEL (sorry that I didn't paste image, but I don't  know how to do it on this blog)

       

      indexitemfrom tochosen to sample random variable2
      13=J3 ( random variable)=E4 (from)+D4 (item)-1=AND($J$4>=E4;$J$4<=F4) Sampling Interwal5
      22

      =IF(G4;1;F4+1)

      (if above sample is chosen then start from 1 else start  from previous (to))

       

      =E5+D5-1=AND($J$4>=E5;$J$4<=F5)   
      34=IF(G5;1;F5+1)=E6+D6-1=AND($J$4>=E6;$J$4<=F6)   
      41=IF(G6;1;F6+1)=E7+D7-1=AND($J$4>=E7;$J$4<=F7)   
      54etcetcetc   
      61      
      72      
      85      

       

       

      and below is result in excel

       

      indexitemfrom tochosen to sample random variable2
      1324FALSE Sampling Interwal5
      2256TRUE   
      3414FALSE   
      4155TRUE   
      5414FALSE   
      6155TRUE   
      7212FALSE   
      8537TRUE   

       

       

      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        Chris1979 

        Unfortunately i can't help you with this. Maybe you want to start a new discussion. There are several experts who might be able to help you with a Power Query solution. And could you add the column names to your tables like in the example below:

         

        column Ecolumn Fcolumn Gcolumn Hcolumn Icolumn Jcolumn Kcolumn L
        indexitemfrom tochosen to sample random variable2
        1324FALSE Sampling Interwal5
        2256TRUE   
        3414FALSE   
        4155TRUE   
        5414FALSE   
        6155TRUE   
        7212FALSE   
        8537TRUE   
    • TomF1212's avatar
      TomF1212
      Copper Contributor
      Thank you very much! Will try on my database.

Resources