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

Show the 3 next month when selecting a date

Hello, 

 

I have a problem with Power BI, i want to select 3 months in a row 

 

Exemple : When clicking to the Segment "June 2024" , i want display on a table the values for June, July and August. I want to work with months.

 

I tried with create a new table of table with this but it doesn't work 

 

Selected Month=

VAR MinDate = SELECTEDVALUE(Date[Month])

VAR MaxDate = SELECTEDVALUE(Date[Moonth])+3

VAR CurrentDate = SELECTEDVALUE(Table(Month))

Return IF(CurrentDate<=MaxDate && CurrentDate >= MinDate,1)

 

Please someone can help me ?

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

Hi , @Kingnico63000 

According to your descritption, you want to "Show the 3 next month when selecting a date".

Here are teh steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1675046023375.png

(2)We can click "New table" to create a date table  and we do not need to create any realtionship between two tables:

Date = ADDCOLUMNS( CALENDAR(EOMONTH( FIRSTDATE('Table'[Date]),-1)+1 , EOMONTH(LASTDATE('Table'[Date]),3)) , "Year_month" , FORMAT([Date],"yyyy-mm"))

(3)Then we can create a measure like this:

Measure = var _slicer_date = MAX('Date'[Date])
var _first_date = EOMONTH(_slicer_date,-1)+1
var _last_date = EOMONTH(_slicer_date,2)
var _cur_date =  MAX('Table'[Date])
return
IF(_cur_date>= _first_date && _cur_date <= _last_date ,1,0)

(4)Then we can put the measure on the "Filter on this visual" and then we can meet your need:

vyueyunzhmsft_1-1675046379215.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @Kingnico63000 

According to your descritption, you want to "Show the 3 next month when selecting a date".

Here are teh steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1675046023375.png

(2)We can click "New table" to create a date table  and we do not need to create any realtionship between two tables:

Date = ADDCOLUMNS( CALENDAR(EOMONTH( FIRSTDATE('Table'[Date]),-1)+1 , EOMONTH(LASTDATE('Table'[Date]),3)) , "Year_month" , FORMAT([Date],"yyyy-mm"))

(3)Then we can create a measure like this:

Measure = var _slicer_date = MAX('Date'[Date])
var _first_date = EOMONTH(_slicer_date,-1)+1
var _last_date = EOMONTH(_slicer_date,2)
var _cur_date =  MAX('Table'[Date])
return
IF(_cur_date>= _first_date && _cur_date <= _last_date ,1,0)

(4)Then we can put the measure on the "Filter on this visual" and then we can meet your need:

vyueyunzhmsft_1-1675046379215.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Kingnico63000
Regular Visitor

Hello, i want a dynamic filter, 

 

When click on the segment "June" i have June, July and August

 

And after, when click on "Septembre", display September, October and December

sandeephijam
Helper I
Helper I

Hi Kingnico63000

 

have you tried the report filter options avalibale on power BI

sandeephijam_0-1674844145399.png

 

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.