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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RekhaSurya
New Member

undefined

Hi There,

 

I have a table which has columns 1. Material 2. Weeknum and 3.Backlog value... I am trying to create a dax formula where in the material in the Max(Calendar week) (-also current week )is repeating in the previous week it should be called as Consecutive if it's not available in immediate previous week but available in other weeks it should be considered as Recurring and anything new for the first time in the current week is called New material. Please help me with Dax formula or any other solution 

IMG-20240423-WA0015.jpeg

1 REPLY 1
amitchandak
Super User
Super User

@RekhaSurya , You need to have a date of the week table with the week rank 

 

Have these new columns in Date Table, Week Rank is Important in Date/Week Table

Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format

 

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

 

Before Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]<max('Date'[Week Rank])-1))

 

 

You can create a measure

 

M1= Switch ( True() ,

Not(isblank([This Week])) && Not(isblank([Last Week])) , "Consecutive" ,

Not(isblank([This Week])) && Not(isblank([Before Last Week])) , "Recurring" ,

"Other"

)

 

 

In case you it in filter, you can try segmentation

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors