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
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
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.