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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-jayw-msft
Community Support
Community Support

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.