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
phaum1967
Resolver I
Resolver I

Calculate sum of amounts with a date filter

Hi everyone,

This is my table:Capture d’écran 2019-06-21 à 07.25.43.png

I would like to have only sum of amount depending on  (Type could be actual, budget, forectast,..), on GL account (which is not visible in my screen shot) for the last actual date.

I try this:

LastPerAAMM:=CONCATENATE(YEAR([LastPeriod]);CONCATENATE("-";FORMAT(Month([LastPeriod]);"00")))

to find last month info (formated AAAA-MM)

and sum like that:

LastPeriod$:=CALCULATE(sum(Data[Montant]);filter(Data;Data[AAA-MM]=[LastPerAAMM]))

 

Result is that LastPeriod$ is empty.

 

I tried this:

LastPeriod:=CALCULATE(Max(Data[Date]);Data[Type]="actual"

with this:

LastPeriod$:=CALCULATE(sum([Montant]);filter(Data;Data[Date]=[LastPeriod]))

 

LastPeriod$ equal sum of all months like it does not take into account filter...

 

thanks for helping 🙂

 

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @phaum1967 ,

By my test, the following is my sample you can have a try. And the data is not exactly the same as yours. I add the column of GL and the type of budget.

 

I create a calculated column of LastPerAAMM.

LastPerAAMM = CONCATENATE(YEAR([LastPeriod]),CONCATENATE("-",FORMAT(Month([LastPeriod]),"00")))

0.jpg

Measure = CALCULATE(SUM(Table1[Amount]),ALLEXCEPT(Table1,Table1[GL],Table1[Type],Table1[LastPerAAMM]))

1.jpg

If the result is not what you want, please post the expected output.

 

Best Regards,

Xue Ding

 

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

 

Best Regards,
Xue Ding
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-xuding-msft
Community Support
Community Support

Hi @phaum1967 ,

By my test, the following is my sample you can have a try. And the data is not exactly the same as yours. I add the column of GL and the type of budget.

 

I create a calculated column of LastPerAAMM.

LastPerAAMM = CONCATENATE(YEAR([LastPeriod]),CONCATENATE("-",FORMAT(Month([LastPeriod]),"00")))

0.jpg

Measure = CALCULATE(SUM(Table1[Amount]),ALLEXCEPT(Table1,Table1[GL],Table1[Type],Table1[LastPerAAMM]))

1.jpg

If the result is not what you want, please post the expected output.

 

Best Regards,

Xue Ding

 

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

 

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

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.