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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.