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
PGDEV
Regular Visitor

Cumulative value between two dates

Hello guys,

 

Someone can help me please ?

 

I want to cumulate NB of the last X months (in this example, I used 12 months).

Cumul = CALCULATE(SUM('12MoisGlissant'[NB]);DATESBETWEEN('12MoisGlissant'[M];'12MoisGlissant'[M-12];'12MoisGlissant'[M]))

 

I also tried DATESINPERIOD but I have the same results.

 

See below :

 

Thank you very much !

 

Have good day

1 ACCEPTED SOLUTION
PGDEV
Regular Visitor

I find a solution :

Cumul = 
VAR MValue = '12MoisGlissant'[M]
VAR M12Value =  '12MoisGlissant'[M-12]
RETURN
calculate(SUM('12MoisGlissant'[NB]);filter('12MoisGlissant';and('12MoisGlissant'[Début de mois]<=MValue;'12MoisGlissant'[Début de mois]>=M12Value)))

View solution in original post

2 REPLIES 2
PGDEV
Regular Visitor

I tried it but doesn't work :

Mesure = 
VAR MValue = SELECTEDVALUE('12MoisGlissant'[M])
VAR M12Value =  SELECTEDVALUE('12MoisGlissant'[M-12])
RETURN
calculate(SUM('12MoisGlissant'[NB]);filter('12MoisGlissant';DATESBETWEEN('12MoisGlissant'[Début de mois];M12Value;MValue)))
PGDEV
Regular Visitor

I find a solution :

Cumul = 
VAR MValue = '12MoisGlissant'[M]
VAR M12Value =  '12MoisGlissant'[M-12]
RETURN
calculate(SUM('12MoisGlissant'[NB]);filter('12MoisGlissant';and('12MoisGlissant'[Début de mois]<=MValue;'12MoisGlissant'[Début de mois]>=M12Value)))

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.