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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
fadingvision
Frequent Visitor

Add a column based on multiple conditions

Hello Everybody,

I'm pretty new to Power BI, maybe some of you can help me.

On this table i need to add a column that would be filled by the requested quantity (SOLICITADO) and distributed by stock quantity (CANTIDAD DISPONIBLE). Since the stock is limited, it must consider client's priority (PRIORIDAD; 1=HIGHEST PRIORITY) and purchase order's date (FECHA O/C) in this particular order.

The tricky thing is that i need that the stock number somehow was decreasing o descounting as the products were asigned to the priority clients and keep asigning the remaining to the less priority ones (it can be done?).

*Requested products and stock are from different tables related by CAI (ID)

 

This is the table i'm filling

tabla.PNG

 

Here an example with values

CLIENTE GRUPO,CLIENTE CHILE,CAI,FECHA O/C,SOLICITADO,CANTIDAD DISPONIBLE,CDR,PRIORIDAD
KMTS,KMTS CHL S..,302244,2018-05-14 00:00:00,152,66,,2
BHP,MNR SCNDD LTD.,532463,2018-08-01 00:00:00,123,26,120,1
MS,MNR LS PLMBRS,302446,2018-05-16 00:00:00,120,184,207,2
NMX,MPRTDR Y DSTRBDR NMX S.,123425,2018-08-01 00:00:00,90,2,15,2
BHP,C.MNR CRR CLRD LTD,274589,2018-08-01 00:00:00,81,5,1,1
KLTR,KL TR S..,845075,2018-08-01 00:00:00,80,,78,1
KGHM,SRR GRD SCM,302446,2018-01-11 00:00:00,70,184,207,2
CV,NGNR CVL VCNT S..,349567,2017-12-29 00:00:00,64,13,29,2
GLNCR,C.MNR XSTRT LMS BYS.,289227,2017-11-01 00:00:00,61,2,13,1

Let me know if you need something else or if i wasn't clear about my issue.

 

Thanks in advance!

Regards

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@fadingvision,

 

You may start from the code generated by Quick measure Running total.

Community Support Team _ Sam Zha
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

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@fadingvision,

 

You may start from the code generated by Quick measure Running total.

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors