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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
tarun912
Helper IV
Helper IV

monthwise previous year data on line chart

Hi everyone, 

Hope you guys are doing great. I am new to POWER BI, I want to implement one thing that if i have admissions data that contains admission ID and a DATE Column that contains date in this format (dd-mmm-yy) so, I would like to display a line chart that contains Admissions on a monthly basis and also 1 year back data.

For eg: Now it is April 2020 so I want the data to publish in a line chart is of Mar 2020 to Apr 2019.

@BA_Pete , @az38 , @parry2k , @amitchandak 

Can somebody please look into this ?
Thanks !

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

Hi @tarun912 ,

 

You could create a measure and add it in the filter pane.

Measure = 
var a = DATEDIFF(SELECTEDVALUE('Table'[Date]),TODAY(),MONTH)
return
IF(a<=12,1,0)

Then set the rule to show the result whose measure is 1.

 

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

View solution in original post

5 REPLIES 5
v-eachen-msft
Community Support
Community Support

Hi @tarun912 ,

 

You could create a measure and add it in the filter pane.

Measure = 
var a = DATEDIFF(SELECTEDVALUE('Table'[Date]),TODAY(),MONTH)
return
IF(a<=12,1,0)

Then set the rule to show the result whose measure is 1.

 

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

Hi @tarun912 

 

You can get the month dimension in your table by adding the following column to it:

monthNameShort =
FORMAT( Table[Date], "MMM" )

or

monthNameLong =
FORMAT( Table[Date], "MMMM" )

 

Then you can either use the Relaive Date Slicer if you want end users to adjust time period, or you can use the 'Top N' filter on the visual itself. You would filter on monthNameShort, Top N, Top 12, by Latest [Date].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi @BA_Pete , 

 

I got your point but I can't use relative date slicer as it hampers my UI, I don't have to change my UI, Have some UI Constraints as well.
Need to do something by measure or creating column.

Thanks ! 

No problem.

Just add the monthName column, use this as the chart axis, and then use the visual-level filter to do the Top N solution I mentioned.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




amitchandak
Super User
Super User

If you date has been detected as date you can use relative date slicer

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

I am hosting a webinar on 25th April on Power BI, Check Details - https://www.linkedin.com/posts/amitchandak78_webinar-tech-techforgood-activity-6658266754378231808-y...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.