Forum Discussion

Sofinobi's avatar
Sofinobi
Helper IV
3 years ago
Solved

average quantity

hi community,

i have a table that saves the operations about our products (sales and purchases), there is a column "Quantity Now" that calculate the quantity in stock (after sale or purchase).

i need to calculate the average "Quantity Now" by month, t tried a simple average fonction and it works, but one thing, it's about when there is not operations for a product in a month it shows me "0", i ned to show me it this case, the average of last month.

 

thank you all

  • Sofinobi , Assume you are using measure m1 as of now

    if(isblank([M1]),

    CALCULATE(AverageX(Values('Date'[Month Year]), [M1]),filter(all('Date'),'Date'[date] <=max('Date'[date]))), [M1])

2 Replies

  • Sofinobi , Assume you are using measure m1 as of now

    if(isblank([M1]),

    CALCULATE(AverageX(Values('Date'[Month Year]), [M1]),filter(all('Date'),'Date'[date] <=max('Date'[date]))), [M1])

    • Sofinobi's avatar
      Sofinobi
      Helper IV

      thank you for your help, thats exactely what i want.

      thanx