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

power bi dax group months into 2 month increments

Hello,

 

I have a date table and I am trying to create a column that breaks the dates up into 2 month periods so 

Jan-Feb

Mar-Apr

May-Jun

Jul-Aug

Sep-Oct

Nov-Dec

 

I only see how to do this with Month, Qtr, Week 

 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @mcornfield ,

Please have a try.

First, create a column.

 

 

Column = QUOTIENT('Table'[date].[MonthNo]+1,2)

 

 

Then create a measure.

 

 

sum_ = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[Column]=SELECTEDVALUE('Table'[Column])))

 

 

11.PNG

Best Regards

Community Support Team _ Polly

 

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

View solution in original post

3 REPLIES 3
v-rongtiep-msft
Community Support
Community Support

Hi @mcornfield ,

Please have a try.

First, create a column.

 

 

Column = QUOTIENT('Table'[date].[MonthNo]+1,2)

 

 

Then create a measure.

 

 

sum_ = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[Column]=SELECTEDVALUE('Table'[Column])))

 

 

11.PNG

Best Regards

Community Support Team _ Polly

 

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

amitchandak
Super User
Super User

@mcornfield , You can 2 month period like

 

new columns

 

2 month period = Quotient(Month([Date])+1)

 

Year Period  = Year([Date])*100 + [2 month period]


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

 

 

Then you can have 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))

Thanks! are you sure you meant to use Quotient I think that's a division?

https://docs.microsoft.com/en-us/dax/quotient-function-dax

 

mcornfield_0-1639153911315.png

 

 

 

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.

Top Solution Authors