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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
s_fs
Regular Visitor

count of values based on condition

I have created a table visual there I have a column which is numeric and it is weekyear like 202501,202502,202503 ... Then I have a another columns called in-hand goods and demand  for the respective weekyear. Now I want to create measure how much I have covered. This measure says that my present weekyear,let say 202501 in-hand goods are 4000 and demand for 202502 is 2000 means I can survive next week with my inhand goods and then we will check for next week 202503 demand which is 1500 . So, we still can survive 202503 week also, for 202504 demand is 1000 . Now comes the point where you exhausted with your inhand stock which is 2000+1500+1000 >= 4000.now I want to count the distinct weekyear which is 3  here. Also the safe week means 202503 is the week where we are safe with our goods based on the demand.so,i need to get the sum means 2000+1500 =3500 also. Here 2 variable I need to achieve,Let me know how can I achieve this in dax.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

That's all very nice but what happens when new demand comes in, and when you restock?

 

DAX is incapable of doing conditional accumulations. Your only chance is Power Query List.Accumulate

 

Or - use a proper material planning app, rather than a reporting tool.

View solution in original post

4 REPLIES 4
s_fs
Regular Visitor

Hi, As of now my data doesn't contain restock column . stock covered calculation I wanted to do based on 2 variables I have mentions ,I can't able to achieve those using DAX .

s_fs
Regular Visitor

Hi ,as of now my data is not having restock column . the measure stock covered is based on the above variables that I have mentioned which is the count and sum of survival in hand goods.

lbendlin
Super User
Super User

That's all very nice but what happens when new demand comes in, and when you restock?

 

DAX is incapable of doing conditional accumulations. Your only chance is Power Query List.Accumulate

 

Or - use a proper material planning app, rather than a reporting tool.

Hi, As of now my data doesn't contain restock column . stock covered calculation I wanted to do based on 2 variables I have mentions ,I can't able to achieve those using DAX .

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Kudoed Authors