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

Sum pending values with based on the previous month

Hi guys,

 

I'm trying to create a measure that shows me the sum of outstanding amounts in the current month based on the amounts that occurred in the previous month. I need to put this total amount on the card. Can you help me, please?

flaviobdsti_0-1671130732628.png

flaviobdsti_2-1671131541246.png

 

 

 

 




1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @flaviobdsti 

 

You can try the following methods.

vzhangti_0-1671180595322.png

Measure:

JAN = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),MONTH([Date])=1&&[ID]=SELECTEDVALUE('Table'[ID])))
FEB = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),MONTH([Date])=2&&[ID]=SELECTEDVALUE('Table'[ID])))

vzhangti_1-1671180639832.png

Measure = SUMX(FILTER(ALL('Table'),[FEB]=BLANK()&&MONTH([Date])=1),[JAN])

vzhangti_2-1671180682615.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @flaviobdsti 

 

You can try the following methods.

vzhangti_0-1671180595322.png

Measure:

JAN = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),MONTH([Date])=1&&[ID]=SELECTEDVALUE('Table'[ID])))
FEB = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),MONTH([Date])=2&&[ID]=SELECTEDVALUE('Table'[ID])))

vzhangti_1-1671180639832.png

Measure = SUMX(FILTER(ALL('Table'),[FEB]=BLANK()&&MONTH([Date])=1),[JAN])

vzhangti_2-1671180682615.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

Thanks a lot for the precious help.

vicky_
Super User
Super User

Is there any reason you can't do SUM(January) - SUM(February)?

It doesn't work because Jan (last month) and Feb (current month) are measured:

Current month = CALCULATE(SUM(BillsReceive[value_document]),GROUPBY(dimIDJ,dimIDJ[IDJ]))


Last month = CALCULATE([Current month],DATEADD(dimCalendar[Date],-1,MONTH))

I get the desired result only when I add the measures in a table and configure a filter on the screen for the current month (feb) = blank()

But I need to be able to do this in a measure to add to a card



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