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
Sylvine_Wyz
Helper IV
Helper IV

SOMME DES VENTES SEMAINE ACTUELLE ET SEMAINE DERNIERE

Bonjour, 

 

j'aimerai calculer la somme des ventes pour la semaine dernière et pour la semaine en cours.
La formule qui permettra de calculer la somme des ventes de la semaine dernière sera utilisé dans un KPI
afin de savoir l'évolution de cette semaine par rapport à la semaine précédente.

Pouvez vous m'aider svp ?

merci par avance.

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@Sylvine_Wyz 

You need first create a weeknumber column:

Weeknumber = WEEKNUM('Table'[Date])
 
Then you may create measures for current and previous week value with below formulas. Check the sample pbix if needed.
 

Current week value =
VAR Currentweek = CALCULATE ( MAX ( 'Table'[Weeknumber] ), ALLSELECTED ('Table'))
Return CALCULATE (SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Weeknumber] = Currentweek))

Previous week =
VAR previousweek = CALCULATE ( MAX ( 'Table'[Weeknumber] ), ALLSELECTED ('Table')) -1
Return CALCULATE (SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Weeknumber] = previousweek))

 

 current vs previous week.JPG

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@Sylvine_Wyz 

You need first create a weeknumber column:

Weeknumber = WEEKNUM('Table'[Date])
 
Then you may create measures for current and previous week value with below formulas. Check the sample pbix if needed.
 

Current week value =
VAR Currentweek = CALCULATE ( MAX ( 'Table'[Weeknumber] ), ALLSELECTED ('Table'))
Return CALCULATE (SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Weeknumber] = Currentweek))

Previous week =
VAR previousweek = CALCULATE ( MAX ( 'Table'[Weeknumber] ), ALLSELECTED ('Table')) -1
Return CALCULATE (SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Weeknumber] = previousweek))

 

 current vs previous week.JPG

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

do you want to compare the entirety of the previous week to the current week? That is pretty unfair if the current week is "young".  Wouldn't you want to compare only the weekdays that both weeks have in common?

Oui c'est vrai, vous avez raison. 
Dans ce cas, il faudrait comparé la semaine -2 avec la semaine -1.
L'idée est d'utiliser ces formules, pour connaitre : 
-l'évolution des ventes 


Ensuite j'aimerai créer un tableau de bord, où nous puissions analyser, l'évolution des ventes, quels ont été les meilleurs fournisseurs, les meilleures articles, et l'évolution de ceux ci par rapport à la semaine d'avant.

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.