Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sofinobi
Helper IV
Helper IV

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 allCapture.PNG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@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])

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

thanx

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors