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

Hide months Without Affecting Values in cumulative line chart - based on a filter

Hello,

I have a cummulative line chart using the following calculations:

     Submitted_running = calculate(sum([SubmittedCR]), FILTER(ALL(Orders[Date]),Orders[Date]<=max(Orders[Date])))
 
All data is on table [Orders].
 image.png
 
As you can see, it starts back in 2016. What I would like to achieve is to place a filter (slicer) that displays only last 3-6-12 months of data. Because I have the cummulative sum, I cannot just ad a filter by [Date] as if will affect the calculations.
 
Thank you,
M.R.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Create a date calendar and join with your date. Move this calculation there and try the filter

Submitted_running = calculate(sum([SubmittedCR]), FILTER(ALL(Date),Date[Date]<=max(Date[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

View solution in original post

6 REPLIES 6
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a measure as below and add it to visual level filter.

Measure 2 = IF(FORMAT(SELECTEDVALUE('Table'[date]),"YYYYMM")>FORMAT(EDATE(TODAY(),-SELECTEDVALUE('Table (2)'[Column1])),"YYYYMM"),1,BLANK())

1.PNG

2.PNG

3.PNG 

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

Thank you but plese be aware that I have a cummulative sum and I can not just filter previous data. I tried your approach, it does not work

amitchandak
Super User
Super User

Create a date calendar and join with your date. Move this calculation there and try the filter

Submitted_running = calculate(sum([SubmittedCR]), FILTER(ALL(Date),Date[Date]<=max(Date[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Anonymous
Not applicable

Hi amit chandak,

 

I figured it out:

calculate(sum([SubmittedCR]), FILTER(ALL(Calendar[Date]),Calendar[Date]<=max(DataTable[Date])))
 
Accepted as solution.
 
Thanks,
M.R.
Anonymous
Not applicable

I created a Calendar table but I am not able to get this to work.

Lets's say my table is called [DataTable] and the calendar table is called [Calendar]

 

Is this is the calculation?

Submitted_running = calculate(sum([SubmittedCR]), FILTER(ALL(Calendar),Calendar[Date]<=max(Calendar[Date])))

Anonymous
Not applicable

Yes, I can probably do that but is there any other simple solution without creating a Calendar?

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.