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

Accumulate Measure per month not working

Hello,

 

I am trying to make an accumulate vision using the following expression:

 

= CALCULATE(SUM('Value.amount');

FILTER(ALL('calendar'); 

'calendar'[date] <= MAX('calendar'[date])))

 

But it is not accumulating on the graphic vision:
Capturar.JPG

 

The black line is my target that is called "Meta" and is like this in the table:

Capturar.JPG


Do I have to make something else to get my data accumulated?

1 ACCEPTED SOLUTION

Hi @VitorXavier 

Your measures are working fine. The only issue is that you are using the month name only in the rows of the table visual and then the MAX(Table1[Datas]) if the last day of that month in 2020 (which is the max in the calendar table). Since all your values are in 2019 in both fact tables, you get the whole thing. SO you need to add the year to the filter context. If you place a slicer selecting year 2019 this problem is solved. See it all at work in the attached file. 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

9 REPLIES 9
AlB
Super User
Super User

Hi @VitorXavier 

Are you using Month from the calendar table in the x-axis of the visual?

Can you share the pbix? or a simplified version that reproduces the problem? 

Hi @AlB,

 

Thanks for answer.

 

Yes, I am using Month from calendar table.

 

I want to share with you a simplified version, but I didn't find a way to insert the pbix attachment. How can I share with you?

 

 

 

You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

I uploaded at TinyUpload.com follow the URL: http://s000.tinyupload.com/?file_id=06151779987823636435 

Hi @VitorXavier 

Your measures are working fine. The only issue is that you are using the month name only in the rows of the table visual and then the MAX(Table1[Datas]) if the last day of that month in 2020 (which is the max in the calendar table). Since all your values are in 2019 in both fact tables, you get the whole thing. SO you need to add the year to the filter context. If you place a slicer selecting year 2019 this problem is solved. See it all at work in the attached file. 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

Thank you very much @AlB , your explanation worked!

@AlB  If I want to see an accumulated view of two years in the same graphic, 2018 and 2019 for example, for I comparer one year with another, how can I do?

@VitorXavier 

You mean you want to see one line per year in the same chart? With what you have, the quickest would be to place Calendar[Year] in the legend of the chart, so that you have them separated by year and modify the measure a bit so that it only accumulates from the beginning of that year. If you want it to accumulate from the beginning of time, just remove the year condition in FILTER().See it all at work in the attached file. 

 

Meta Acumulada V2 = 
 0 + CALCULATE (
        SUM ( 'Metas UPSELL AGO-DEZ'[Meta] );
        FILTER (
            ALL ( 'Calendário' );
            'Calendário'[Datas] <= MAX ( 'Calendário'[Datas] )
                && YEAR ( 'Calendário'[Datas] ) = YEAR ( MAX ( 'Calendário'[Datas] ) )
        )
    )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

 

@AlB 

 

The data of the years are separated in different tables and the expression won't work in this case. I tried to put the calendar[year] in the legend but didn't work.

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