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
Anonymous
Not applicable

Need Help with Cumulative difference based on item#

Hi,

 

I am reaching out to this group for help in calculating cumulative difference of quantity for an item. and the calculation for first instance of the item will be base calculation where as the other instances of the same item follow the base calc differnce from the total quantity. My example here would explain better than my words. any help on this is highly appreciated !! 

Thanks!

 

DescriptionItem #Month YearTotal FqtyRequired ( same as Total Fqty)Curr Released Inv Qty (Base qty)Curr Quarantine Inv Qty (Base Qty)Open QtyQty Remaining (**bleep** Diff)Calc logic required
XXXXItem0001Apr-202011150014Only for the first row for the item - the calculation is  Required - (Curr Released Inv Qty + Curr Qurantine Inv Qty + Open Qty)
XXXXItem0001May-20209915005Above value + (Open Qty - Required)
XXXXItem0001Jun-202013131500-8Above value + (Open Qty - Required)
YYYYItem0002Apr-20202223900237follow the first value calculation for first instance of the item
Only for the first row for the item - the calculation is  Required - (Curr Released Inv Qty + Curr Qurantine Inv Qty + Open Qty)
YYYYItem0002May-2020181823900219Above value + (Open Qty - Required)
YYYYItem0002Jun-2020262623900193Above value + (Open Qty - Required)
11 REPLIES 11
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Allan

 

Anonymous
Not applicable

thanks for trying, but the solution mentioned didnt work for the second item, which has to reset the calculation. I have manged to write a measure calculation on my own. 

Hi, @Anonymous 

 

If possible, could you please share the measure to help the other members who have same problems find it more quickly. Thanks.

 

Best Regards

Allan

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

You may create a calculated column and a measure as below. The pbix is attached in the end.

FormattedMonthYear = VALUE(FORMAT(Sheet1[Month Year],"yyyymm"))
Qty Remaining = 
var _base =
CALCULATE(
    AVERAGE(Sheet1[Curr Released Inv Qty (Base qty)]),
    FILTER(
        ALL(Sheet1),
        Sheet1[Item #] = SELECTEDVALUE(Sheet1[Item #])
    )
)
var _required = 
CALCULATE(
    SUM(Sheet1[Required ( same as Total Fqty)]),
    FILTER(
        ALL(Sheet1),
        Sheet1[Item #] = SELECTEDVALUE(Sheet1[Item #])&&
        Sheet1[FormattedMonthYear]<=SELECTEDVALUE(Sheet1[FormattedMonthYear])
    )
)
return
_base-_required

 

Result:

c1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

negi007
Community Champion
Community Champion

@AnonymousYour calculation seems to be little complicated to achieve but not impossible. I request you to share your excel file with the calculation, will then suggest appropriate solution to you. Thanks




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Anonymous
Not applicable

Thanks for the reply, i am unable to attach my PBI file or Excel file in this post. How can i do that?

Anonymous
Not applicable

Attached the link to files here. 

 

PBIX file 

 

Inv calc comm 

Anonymous
Not applicable

any help on this calculation is much appreciated. thanks!

@AnonymousYou could use google drive or one drive to attached powerbi file. Else you can share your excel file with formula calculation that would also help




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

amitchandak
Super User
Super User

@Anonymous , not very clear what you mean by the above value. The logic does not fit in

We can create a measure like

Cumm balance= CALCULATE(SUM(Table[Released]),filter(date,date[date] <=max(Table[Date])))

- CALCULATE(SUM(Table[Required]),filter(date,date[date] <=max(Table[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Anonymous
Not applicable

Thanks Amit for the reply, Above here refers to the previous value of the item's reamin Qty.

 

XXXXItem0001Apr-202011150014
XXXXItem0001May-2020991500(14- (0+9)) (Previous value + (Open Qty - Required Qty))

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.