Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
NewPBIe
Helper II
Helper II

Timeline & Cumulative Filter

Hello everybody, 

 

I have a Timeline and a Table.

 

The Table has a Date-Column and a Score-Column. 

 

If i select the fiscal period 1 (october 22), the table shows the data, that are in october 22. 

I need to show data from the beginning up to september 22.

 

Also: for every period p, all the previous months until p-1.

 

Is this possible? Thank you guys!

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @NewPBIe ,

One date dimension table should be exist in your model. And the date table don't create relationship with your fact table. You can refer the following blogs to achieve it.

Show data for the last N months based on a selected month

 

Sales N last Months =
VAR toDate =
    MAX ( 'Date'[Date] )
VAR fromDate =
    EDATE ( toDate, -1 * 'Previous months'[Previous months Value] ) + 1
RETURN
    CALCULATE (
        Sales[Sales Amount],
        ALL ( 'Date' ),
        DATESBETWEEN ( Date_Helper[Date], fromDate, toDate )
    )

 

yingyinr_3-1671768077438.png

Display Last N Months & Selected Month using Single Date Dimension in Power BI

yingyinr_0-1671767994034.gif

If the above one can't help you get the desired result, please provide some raw data in your table  (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @NewPBIe ,

One date dimension table should be exist in your model. And the date table don't create relationship with your fact table. You can refer the following blogs to achieve it.

Show data for the last N months based on a selected month

 

Sales N last Months =
VAR toDate =
    MAX ( 'Date'[Date] )
VAR fromDate =
    EDATE ( toDate, -1 * 'Previous months'[Previous months Value] ) + 1
RETURN
    CALCULATE (
        Sales[Sales Amount],
        ALL ( 'Date' ),
        DATESBETWEEN ( Date_Helper[Date], fromDate, toDate )
    )

 

yingyinr_3-1671768077438.png

Display Last N Months & Selected Month using Single Date Dimension in Power BI

yingyinr_0-1671767994034.gif

If the above one can't help you get the desired result, please provide some raw data in your table  (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@NewPBIe ,

Last month  + MTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-2)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

 


This Month+Last Month  =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),0)
var _min = eomonth(_max,-2)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

 

In case you want display Sep /Oct on Axis, then slicer need to be on an independent date table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -2) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.