cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
siva54
Helper I
Helper I

Last 3 months from selected Month

Hi Team,

 

I need to calculated column for  last 3 months from selected month.

 

for example, if we select "May", then result should is May, April, March.

 

Thanks in advance.

 

 

3 REPLIES 3
VahidDM
Super User
Super User

Hi @siva54 

 

Do you want a table with one column that has three months from the selected month? If yes, you can use DATESINPERIOD and use SELECTEDVALUE as a start date.

But suppose you want a calculated column in your existed table to show last 3 months from the selected month. In that case, you can use the above code and filter to use that in a calculation or add a calculated column and say if a date is in the range, show one; otherwise, zero.

 

Read this link and add more details to your request:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-Get-Your-Question-Answered-Quickly/m-p...

 

Appreciate your Kudos✌️!!

Anonymous
Not applicable

Since there is no any filter context in the Calculated Column you will not be able to achive it based on a filter selection. As per above solution you can do it based on Todays value only.

Hi Kazun909,

 

For More clarification,

 

If i select May then in the table i need to see last three months data(only March, April, May).
we have year also.

 

siva54_0-1632131373325.png

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors