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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
noamshn
Frequent Visitor

weeks and months in x axis

so i have a chart with x axis of all the weeks of the year in this format: "01/01/202 - 07/01/2023". i get this format from a table i created, the table columns are: 

noamshn_0-1692768705913.png

in addition i have a table of hebew months:

noamshn_1-1692768755915.png

 

now, what i want to do is to make a filter in the chart to show only the last 2 months (in the months table the last month will be the current month). the problem is that I didnt succeed to connect between the weeks dates and the months number.
I would be glad for some help here.

Thank you in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @noamshn ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1692859165009.png

(2) We can create a measure. 

Flag = 
var _max=MAXX(ALL('months'),'months'[Value])
var _min=_max-1
return IF(MAX('Table'[Month of the week]) = _max || MAX('Table'[Month of the week])=_min ,1,0)

(3) Place [Flag]=1 on the visual object filter. At this point the visual object will only show the last two months of data.

vtangjiemsft_1-1692859281817.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (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. Thank you.

 

Best Regards,

Neeko Tang

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
Anonymous
Not applicable

Hi @noamshn ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1692859165009.png

(2) We can create a measure. 

Flag = 
var _max=MAXX(ALL('months'),'months'[Value])
var _min=_max-1
return IF(MAX('Table'[Month of the week]) = _max || MAX('Table'[Month of the week])=_min ,1,0)

(3) Place [Flag]=1 on the visual object filter. At this point the visual object will only show the last two months of data.

vtangjiemsft_1-1692859281817.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (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. Thank you.

 

Best Regards,

Neeko Tang

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

Thank you, it worked. but in the end i used "'New Chart'[Week Completed]>WEEKNUM(TODAY())-4" inside the measure, because i realized i need the last 4 weeks.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (350)