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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Apply a couple of filters on calculation

I want to make stock balance by LLITEM & Facility applying a couple of filters but for some reason "Balance" was calculated for all showing LLITEM & Facility.

How can i fix it to calculate stock balance by LLITEM & Facility?

Is it for "ALLSELECTED" ?

Q1.png

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Thanks for your kind advice.

 But if I removed "Allselected", cumulative balance became not applyed even balance show by item & facility.

 

 What I want to get is cumulative balance by week.

For example, Item.ABC has balance of WK20 to "1" for Inv_Qty "1" and then next week 2 of Demand Qty followed up without Inv_Qty & Transit Qty. If that, ideally "-1" show up. But if I removed "Allselected", just "-2" show up as not applied previous weeks' value.

 

  What I used : Balance = CALCULATE(SUM(Append1[Inv_Qty])-SUM(Append1[Demand Qty])+SUM(Append1[Transit_Qty]),FILTER(Append1,Append1[Week ending] <= MAX(Append1[Week ending])))

 

 What should I do to get cumulative balance by week of each item and facility?

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this one:

 Balance = CALCULATE(SUM(Append1[Inv_Qty])-SUM(Append1[Demand Qty])+SUM(Append1[Transit_Qty]),FILTER(ALLSELECTED(Append1),Append1[Week ending] <= MAX(Append1[Week ending])), VALUES(Append[LLITFM]),VALUES(Append[Facility]))

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

Anonymous
Not applicable

Highly thanks, Dina for your big help.

 Now it resolved as I revised it as you recommend 🙂 Fantastic. !!

View solution in original post

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this one:

 Balance = CALCULATE(SUM(Append1[Inv_Qty])-SUM(Append1[Demand Qty])+SUM(Append1[Transit_Qty]),FILTER(ALLSELECTED(Append1),Append1[Week ending] <= MAX(Append1[Week ending])), VALUES(Append[LLITFM]),VALUES(Append[Facility]))

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

Highly thanks, Dina for your big help.

 Now it resolved as I revised it as you recommend 🙂 Fantastic. !!

parry2k
Super User
Super User

@Anonymous i don't think you need allselected in your dax expression, remove that and check.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks for your kind advice.

 But if I removed "Allselected", cumulative balance became not applyed even balance show by item & facility.

 

 What I want to get is cumulative balance by week.

For example, Item.ABC has balance of WK20 to "1" for Inv_Qty "1" and then next week 2 of Demand Qty followed up without Inv_Qty & Transit Qty. If that, ideally "-1" show up. But if I removed "Allselected", just "-2" show up as not applied previous weeks' value.

 

  What I used : Balance = CALCULATE(SUM(Append1[Inv_Qty])-SUM(Append1[Demand Qty])+SUM(Append1[Transit_Qty]),FILTER(Append1,Append1[Week ending] <= MAX(Append1[Week ending])))

 

 What should I do to get cumulative balance by week of each item and facility?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.