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
Lefuneste57
Frequent Visitor

Cumulative SUM by Month by contrat

Hi, sorry for my english, i'm french.

 

I have a table like this and i would calculate the column "Montant cumulé". So, for each Month, the cumulative amount per Month and per N°Contrat.. Can you help me to found the DAX formule for the yellow Column plesae ?

 

 

SnipImage.JPG

 

 

 

 

 

 

 

 

Thanks for helping.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Montant cumule] =
var __noContrat = selectedvalue ( T[N°Contrat] )
var __currentDate = max ( T[Date] )
var __cumule =
	SUMX(
		FILTER(
			ALL ( T ),
			T[N°Contrat] = __noContrat
			&&
			T[Date] <= __currentDate
		),
		T[Montant]
	)
return
	__cumule

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

[Montant cumule] =
var __noContrat = T[N°Contrat]
var __currentDate = T[Date]
var __cumule =
	SUMX(
		FILTER(
			T,
			T[N°Contrat] = __noContrat
			&&
			T[Date] <= __currentDate
		),
		T[Montant]
	)
return
	__cumule

Hi, thanks

but i have another dufficult, i have try your solution but when i have more amount in the same month with négative value, it's no good.

 

For exemple, with this table :

SnipImage.JPG

I must have for N°Contrat C002 a cumulative value of 130.

But with your formule, i have 260 :

SnipImage.JPG

 

Thank you very much for your help.

Anonymous
Not applicable

[Montant cumule] =
var __noContrat = selectedvalue ( T[N°Contrat] )
var __currentDate = max ( T[Date] )
var __cumule =
	SUMX(
		FILTER(
			ALL ( T ),
			T[N°Contrat] = __noContrat
			&&
			T[Date] <= __currentDate
		),
		T[Montant]
	)
return
	__cumule

It's ok !!!

 

Thanks for your help !  Smiley Very Happy

 

Anonymous
Not applicable

What I've given you is a CALCULATED COLUMN, not a measure. You did not say a single word about a measure.

Best
Darek

I'm sorry.

 

Can you help me ?

 

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.

Top Solution Authors