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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mcornfield
Helper III
Helper III

DAX or M Query Help How to Calculate previous or last Cycle

I have a Table Showing [#Achieved]

We look at it by cycle which are 2 month Incements 

Jan- Feb

Mar-Apr

May-Jun 

Etc.

 

I need to figure out how to compare against the previous cycle The formula I have so far works till I break the data out by a different Dimension. See image below

 

mcornfield_0-1639370258645.png

Here is what I am going for:

mcornfield_4-1639370423067.png

 

 
 

 

 

Link to PBIX

https://drive.google.com/file/d/167jGIQ9KoBXLgVjNOPAaXM21nn_mMUxV/view?usp=sharing

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @mcornfield ,

 

You are using ALL() function to wrap the table, so the result won't be filtered by dimensions.

Try using "ALLEXCEPT('Table','Table'[Dimention ])" instead.

 

Best Regards,

Jay

amitchandak
Super User
Super User

@mcornfield ,

 

New columns in date table
Period Name = if( mod(month([Date]),2) =0, format(eomonth([Date],-1),"mmm" ) & "-" &format([date], "mmm") , format([date], "mmm") & "-" & format(eomonth([Date],1),"mmm" ) )

Period Year = Year([Date])*100 + Quotient(month([Date])+1,2)

Period Rank = RANKX(all(Period),Period[year period],,ASC,Dense)


New measures

This Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])))
Last Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])-1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors