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
gvb238
Frequent Visitor

Rolling 3 Months Data

Hi Team,

I Have one Requirement of Rolling 3 Months.  for this Requirement i have Date & Amount fields. For example If i filter June 2018 then it will show like this

 

Month&Year           AMT

May 2018                5000

April 2018                4500

March 2018              6000

 

Regards,

Veera

 

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

Hi @gvb238

Here is an example

1.create a date table and manage relationships between the two table

date table = DISTINCT(Table1[date]) 

2.png

2. add 'date table' [date] to the slicer, then create measures as below

selected month = SELECTEDVALUE('date table'[date]) 

month difference = DATEDIFF(MAX([date]),[selected month],MONTH) 

if last three month = IF([month difference]>=1&&[month difference]<=3,1,0)

3.then add the "if last three month" to the Visual Level filter, and set the condition to "show items when value is 1".

1.png

 

 

Best Regards

Maggie

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @gvb238

Here is an example

1.create a date table and manage relationships between the two table

date table = DISTINCT(Table1[date]) 

2.png

2. add 'date table' [date] to the slicer, then create measures as below

selected month = SELECTEDVALUE('date table'[date]) 

month difference = DATEDIFF(MAX([date]),[selected month],MONTH) 

if last three month = IF([month difference]>=1&&[month difference]<=3,1,0)

3.then add the "if last three month" to the Visual Level filter, and set the condition to "show items when value is 1".

1.png

 

 

Best Regards

Maggie

Anonymous
Not applicable

Hi, tried your solution, and sorry does not work 😞

How can I get the selected date to every row in the table? I have it only on the row related to the selection, and then the next steps can be aplied 😞

Thank you for help ...

Anonymous
Not applicable

The problem is with DATEDIFF funkcion in the previous solution, I get the result 0 in the row of selected Month, other months have blank cell 😞

Anonymous
Not applicable

Hi, tried your solution, and sorry does not work 😞

How can I get the selected date to every row in the table? I have it only on the row related to the selection, and then the next steps can be aplied 😞

Thank you for help ...

Anonymous
Not applicable

@gvb238

 

1) I would sort the list and rank them by date(mm-yyyy).

2) CALCULATE(SUM(x), FILTER(table, table[mnth rank]>= table[mnth rank]-3 && table[mnth rank] <= table[mnth rank])

In my Datasource I don't have any Rank field. How to create rank to that Month&Year (Dimension) and what bases i can create rank.

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.