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

Cumulative with a slicer

I working on doing a cumulative line which is basic using the standard appraoch.

Forecast Cumulative = 
 CALCULATE(
      SUM('Financial'[Forecast]), 
           FILTER(
                ALL('Calendar'), 'Calendar'[Date] <= MAX('Calendar'[Date])  )
                       )

However i would like to be able to slice the data by a given year. But the results i'm getting is wrong. 

The image shows that for Year 2019 the total should be 810k but the cumulative is 910K which is because it is pulling the value from the prior year (2018). I have tried a few different approaches but i've been hitting the proverbial wall on this one.

forecast cumulative isue.PNG

1 ACCEPTED SOLUTION
Aree
Resolver I
Resolver I

Found my solution after some research and testing.

 

Forecast Cumulative = 
 CALCULATE(
      SUM('Financial'[Forecast]), 
           FILTER(
                ALLSELECTED('Calendar'), 'Calendar'[Date] <= MAX('Calendar'[Date])  )
                       )

ALL was causing a filter context outside of my slicer but ALLSELECTED worked like a charm.

View solution in original post

7 REPLIES 7
Aree
Resolver I
Resolver I

Found my solution after some research and testing.

 

Forecast Cumulative = 
 CALCULATE(
      SUM('Financial'[Forecast]), 
           FILTER(
                ALLSELECTED('Calendar'), 'Calendar'[Date] <= MAX('Calendar'[Date])  )
                       )

ALL was causing a filter context outside of my slicer but ALLSELECTED worked like a charm.

Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=CALCULATE(SUM('Financial'[Forecast]),DATESYTD('Calendar'[Date],"31/12"))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @Aree,

 

According to your description and snapshot, your visual seems displayed incorrect records.

 

It seems like financial table not contains records before 9-2019, but calendar date and measure formula expand them with 100k to replace blank records.

 

Can you please share some sample data to help us clarify your scenario and testing?

How to Get Your Question Answered Quickly

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi,

 

This is a sample file a similar structure and issue

Pbix Cumulative issue

Hi,

 

You may refer to my solution here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

lol thanks for the effort mate. I found a solution this morning after some testing and researching. 

 

Special Mention to @Ashish_Mathur

Who offered alternate solution which is pretty sweet.

 

IF(ISBLANK([Forecasts]),BLANK(),CALCULATE([Forecasts],DATESYTD('Calendar'[Date],"30/6")))

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.