Forum Discussion

danb's avatar
danb
Resolver I
7 years ago
Solved

Invoice Drop Size with Slicer

Power BI Community, 

I am running into a quandry in trying to calculate an averasge drop size of a list of invoices for stores. The issue is that i want to have a slicer that will allow me to suppress invoices below a certain total case threshold.

 

Example (Please see attached mockup in excel):

 

In the table below, I have the base data. I also want to layer in a "Drop Size Threshold" slicer (highlighted in yellow) that will allow the user to select either 0,10 or 25. The need would be for whatever the value that is selected in the Drop Size Threshold would then suppress any invoices that are less then the selected value. The picture above has the expected answers. 

 

The calculations for the two results are as follows:

  • Average Drop Size = Average of cases that are >= the Drop Size Threshold
  • # of Drops = Count of the invoices that have total cases >= the Drop Size Threshold 

Here is the base data

RegionInvoice #InvoiceDateStoreTotal Cases
Billings, MT10093/19/2019A7
Billings, MT10193/19/2019A141
Billings, MT10243/20/2019A0
Billings, MT10313/22/2019A1
Billings, MT10473/22/2019A142
Billings, MT10593/26/2019A1
Billings, MT10693/26/2019A140
Billings, MT10833/28/2019A3
Billings, MT11033/29/2019A134
Billings, MT11043/29/2019A2
Billings, MT11174/2/2019A-2
Billings, MT11184/2/2019A-1
Billings, MT11244/2/2019A118
Billings, MT11464/5/2019A126
Billings, MT11474/5/2019A1
Billings, MT11504/6/2019A1
Billings, MT11694/9/2019A120
Billings, MT11784/11/2019A1
Billings, MT11974/12/2019A140
Billings, MT11984/12/2019A1
Billings, MT10133/19/2019B48
Billings, MT10143/19/2019B2
Billings, MT10403/22/2019B23
Billings, MT10653/26/2019B37
Billings, MT10973/29/2019B39
Billings, MT11204/2/2019B62
Billings, MT11414/5/2019B35
Billings, MT11634/9/2019B48
Billings, MT11894/12/2019B27
Billings, MT11904/12/2019B1
Billings, MT10153/19/2019C111
Billings, MT10163/19/2019C1
Billings, MT10433/22/2019C57
Billings, MT10443/22/2019C1
Billings, MT10663/26/2019C75
Billings, MT10743/27/2019C1
Billings, MT11003/29/2019C66
Billings, MT11013/29/2019C1
Billings, MT11214/2/2019C109
Billings, MT11434/5/2019C32
Billings, MT11654/9/2019C101
Billings, MT11924/12/2019C45
Billings, MT10033/18/2019E51
Billings, MT10203/20/2019E-1
Billings, MT10213/20/2019E-2
Billings, MT10323/22/2019E87
Billings, MT10533/25/2019E49
Billings, MT10893/29/2019E74
Billings, MT11063/30/2019E-1
Billings, MT11094/1/2019E58
Billings, MT11344/5/2019E83
Billings, MT11514/6/2019E4
Billings, MT11534/8/2019E60
Billings, MT11814/12/2019E-1
Billings, MT11824/12/2019E71
Billings, MT11834/12/2019E1
Billings, MT12034/15/2019E59

 

Thank you!!!

Dan

  • hi, danb 

    After my research, you could try this way as below:

    Step1:

    Use a What if parameter to add a "Drop Size Threshold" slicer

    https://docs.microsoft.com/en-us/power-bi/desktop-what-if

    or you could custom a "Drop Size Threshold" slicer table and add a Parameter Value measure

    Parameter Value = SELECTEDVALUE('Parameter'[Parameter])

    Step2:

    Then add two measure

    Average Drop Size = CALCULATE(AVERAGE('Table'[Total Cases]),FILTER('Table','Table'[Total Cases]>=[Parameter Value]))
    # of Drops = CALCULATE(COUNTA('Table'[Invoice #]),FILTER('Table','Table'[Total Cases]>=[Parameter Value]))

    Result:

     

    and here is a pbix file, please try it.

     

    Best Regards,

    Lin

2 Replies

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

    hi, danb 

    After my research, you could try this way as below:

    Step1:

    Use a What if parameter to add a "Drop Size Threshold" slicer

    https://docs.microsoft.com/en-us/power-bi/desktop-what-if

    or you could custom a "Drop Size Threshold" slicer table and add a Parameter Value measure

    Parameter Value = SELECTEDVALUE('Parameter'[Parameter])

    Step2:

    Then add two measure

    Average Drop Size = CALCULATE(AVERAGE('Table'[Total Cases]),FILTER('Table','Table'[Total Cases]>=[Parameter Value]))
    # of Drops = CALCULATE(COUNTA('Table'[Invoice #]),FILTER('Table','Table'[Total Cases]>=[Parameter Value]))

    Result:

     

    and here is a pbix file, please try it.

     

    Best Regards,

    Lin

    • danb's avatar
      danb
      Resolver I

      v-lili6-msft  - That did it! Thank you for the detailed and easy to follow solution!