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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
suprdata
Regular Visitor

How to Calculate last 30 days, 60 Days, 90 days, 120 days.

Hi Guys, 

Can you show the dax expressions  how to Calculate last 30 days, 60 Days, 90 days, 120 days. in  power bi dax

5 REPLIES 5
v-zhangtin-msft
Community Support
Community Support

Hi, @suprdata 

 

Have you solved your problem? If it is resolved, please mark the reply that helped you as solution. If not resolved, please provide more information, such as example data and expected results.

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,

Community Support Team _Charlotte

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

Bibiano_Geraldo
Super User
Super User

Hi @suprdata 
I’m assuming you have a date table named 'Calendar' and a measure called [Total Sales].
Last 30 Days Example:

Last30DaysSales =
VAR LastDate = MAX('Calendar'[Date]) -- Obtém a última data visível no contexto
RETURN
CALCULATE(
    [Total Sales],
    FILTER(
        ALL('Calendar'), -- Remove os filtros aplicados para considerar todas as datas
        'Calendar'[Date] > LastDate - 30 &&
        'Calendar'[Date] <= LastDate
    )
)

Last 60 Days Example:

Last60DaysSales =
VAR LastDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
    [Total Sales],
    FILTER(
        ALL('Calendar'),
        'Calendar'[Date] > LastDate - 60 &&
        'Calendar'[Date] <= LastDate
    )
)

 and so on...

Uzi2019
Super User
Super User

Hi @suprdata 

 

Check these videos

https://www.youtube.com/watch?v=JLupF1j49wo&t=4s

https://www.youtube.com/watch?v=RoClVB8-ql4

https://www.youtube.com/watch?v=hDopw1mPlrU

https://www.youtube.com/watch?v=5XNcGL0g-sE

 

 

I hope above videos might help you!

 

I hope I answered your question!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hi @suprdata 

 

If you want calculation like using dax for 30 60 days check these blogs.

https://community.fabric.microsoft.com/t5/Desktop/Help-needed-Past-before-30-60-or-90-days-date-peri...

 

I hope i answered your question!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Rupak_bi
Solution Specialist
Solution Specialist

it depends upon how your table is. Dax will be different if you have multiple entries in an single day. Please share sample table representing your data.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.