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
achrafkasmi
Helper I
Helper I

somme quantité du produit entre deux dates

bonjour, 

 

Je dois calculer une somme de quantité pour chaque produit (Item Code) entre deux dates ( date debut ) et (date fin). (tout mes table sont en  mode direct query).

 

La table initiale qui contient la date debut et fin pour chaque produit (item code) : 

Nom du table : PROMI

achrafkasmi_2-1668509112336.png

 

la table du recherche qui contient les quantités pour chaque produit et la date  : 

Nom du table : V_Qtslivréegms

 

achrafkasmi_3-1668509600050.png

 
Any ideas? 
 
Thank you
1 ACCEPTED SOLUTION

hello @v-yangliu-msft ,

 

thank you for your answer , i used this formula and it's work :

Ventes = CALCULATE(SUM('V_QtsLivréegms'[Quantity]),ALLEXCEPT(PROMI,PROMI[Item Code]),FILTER('V_QtsLivréegms','V_QtsLivréegms'[DocDate] >= MIN(PROMI[dateDebut])&&'V_QtsLivréegms'[DocDate] <= MAX(PROMI[dateFin])))

I added another collumn ( Card Name ) on my table PROMI , i want to make SUM of qunatity for item code and Card Name.

 

thank you so much,

 

 

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @achrafkasmi ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
SUMX(FILTER(ALL('V_Qtslivréegms'),
'V_Qtslivréegms'[Date de chargement]>=MAX('PROMI'[Datedebut])&&
'V_Qtslivréegms'[Date de chargement]<=MAX('PROMI'[date fn])&&
'V_Qtslivréegms'[Item Code]=MAX('PROMI'[Item Code])),[qts])

2. Result:

vyangliumsft_0-1668564198609.png

 

Best Regards,

Liu Yang

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

hello @v-yangliu-msft ,

 

thank you for your answer , i used this formula and it's work :

Ventes = CALCULATE(SUM('V_QtsLivréegms'[Quantity]),ALLEXCEPT(PROMI,PROMI[Item Code]),FILTER('V_QtsLivréegms','V_QtsLivréegms'[DocDate] >= MIN(PROMI[dateDebut])&&'V_QtsLivréegms'[DocDate] <= MAX(PROMI[dateFin])))

I added another collumn ( Card Name ) on my table PROMI , i want to make SUM of qunatity for item code and Card Name.

 

thank you so much,

 

 

achrafkasmi
Helper I
Helper I

any answers please ?

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.