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

Calculate Previuos Period

Hi all,

I'm trying to obtain a table like this:

 

SeasonValuePreviuos Season
2020150006000
201966000

 

 

 

but i can't managed to calculate the Previuos Season.

 

I've tried differentes methods, but nothing seems to work.

ex.

 

Value Pvs Season= CALCULATE(sum(Table[Value]),FILTER(All(Table), Table[Season] = Table[Season] -5))
 
I'm pretty new to Power BI and DAX functions, so someone can help me?
 
Thank you in advance,
--D
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @LJAdmin ,

 

Created for 2 scenarios.

 

1. Your season value differs by 5 everytime.

2. If the above is not the case, you can create an index column .

 

 

You can get your values by creating Calculated Columns

 

2.JPG

 

Create a Calculated Column

 

Previous Value =
// Incase you have an Index Column
//CALCULATE(MAX('Table'[Value]), FILTER('Table','Table'[Index Value] > EARLIER('Table'[Index Value])))


//Incase your Season Value Differs by 5
CALCULATE(MAX('Table'[Value]), FILTER('Table','Table'[Season] = EARLIER('Table'[Season])-5))
 
 
 
You can also get your values using Measures
 
1.jpg
 
 
Previous Value Measure =
// Incase you have an Index Column
//CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), MAX('Table'[Index Value]) = 'Table'[Index Value] - 1 ))


//Incase your Season Value Differs by 5
CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'),MAX('Table'[Season]) = 'Table'[Season]+5))
 
 
 
Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 
 
 

View solution in original post

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @LJAdmin ,

 

Created for 2 scenarios.

 

1. Your season value differs by 5 everytime.

2. If the above is not the case, you can create an index column .

 

 

You can get your values by creating Calculated Columns

 

2.JPG

 

Create a Calculated Column

 

Previous Value =
// Incase you have an Index Column
//CALCULATE(MAX('Table'[Value]), FILTER('Table','Table'[Index Value] > EARLIER('Table'[Index Value])))


//Incase your Season Value Differs by 5
CALCULATE(MAX('Table'[Value]), FILTER('Table','Table'[Season] = EARLIER('Table'[Season])-5))
 
 
 
You can also get your values using Measures
 
1.jpg
 
 
Previous Value Measure =
// Incase you have an Index Column
//CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), MAX('Table'[Index Value]) = 'Table'[Index Value] - 1 ))


//Incase your Season Value Differs by 5
CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'),MAX('Table'[Season]) = 'Table'[Season]+5))
 
 
 
Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 
 
 

Hi,

thank you very much! It works with the Measure Case.

 

 

parry2k
Super User
Super User

@LJAdmin can you share how your data looks like and will get you the solution



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.