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
Anonymous
Not applicable

Calculation dependent on the Value of the previous month

Hi all,

I have a question referring a calculation. The table is bulid as follows:

Rows: "Counterparty"
Colums: "File Date" 
(hierachy from day to year)
Values: "Zinsberechnung"

hbroich_0-1638971864806.png

 


I want to create a measure for the following calculation on a monthly base:

hbroich_1-1638972030512.png

 


If "Sum of previous month" (how to define the variable for the previous month?) > 0, then 0,
If "Value on the first day from the following month" is not 0, than 0, else show the cumulative amount of all values until this day.

Thank you very much for your help!
BR

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

I'm trying to simulate your data, not sure if it's accurate.

Trying to calculate "sum of previous month" with measure is not very comparative. I tried to do some operations with the calculation column to see if it is helpful to you.

month = MONTH('Table'[File Date])
previous month = [month]-1
Sum of previous month =
CALCULATE (
    SUM ( 'Table'[Zinsberechnung] ),
    FILTER (
        ALL ( 'Table' ),
        [Counterparty] = EARLIER ( 'Table'[Counterparty] )
            && [month] = EARLIER ( 'Table'[previous month] )
    )
)
IF = IF([Sum of previous month]>0,"0",BLANK())

vzhangti_1-1639465430139.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

I'm trying to simulate your data, not sure if it's accurate.

Trying to calculate "sum of previous month" with measure is not very comparative. I tried to do some operations with the calculation column to see if it is helpful to you.

month = MONTH('Table'[File Date])
previous month = [month]-1
Sum of previous month =
CALCULATE (
    SUM ( 'Table'[Zinsberechnung] ),
    FILTER (
        ALL ( 'Table' ),
        [Counterparty] = EARLIER ( 'Table'[Counterparty] )
            && [month] = EARLIER ( 'Table'[previous month] )
    )
)
IF = IF([Sum of previous month]>0,"0",BLANK())

vzhangti_1-1639465430139.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

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.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

Vielen Dank im Voraus.

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.