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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ikezaki
Frequent Visitor

Need help with date gap

Hi everyone,

 

I hope you are all safe and well.

 

Im fairly new to DAX and Power BI, I have the following table below

TheWeekReceived dateProcessed dateDateDiff
332021-08-09 2021-08-101
332021-08-10 2021-08-111
332021-08-12 2021-08-131
332021-08-09 2021-08-112
332021-08-11 2021-08-132
332021-08-10 2021-08-133
332021-08-132021-08-163
332021-08-092021-08-134

The column DataDiff is the gap between the Received date and Processed date. What I want to do is to group the DiffGap that are 1-2, 3-4 and 5+ and show in a bar graph where the X axis is the week and the bars are 1-2, 3-4 and 5+. 
So in this example we would have for the week 33 the 1-2 range with count of 5 and for the range 3-4 with the count of 3.

 

Thank you in advance,

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Ikezaki You could do this:

Group Column =
  SWITCH(TRUE(),
    [dateDateDiff] < 3,"1-2",
    [dateDateDiff] < 5,"3-4",
    "5+"
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@Ikezaki You could do this:

Group Column =
  SWITCH(TRUE(),
    [dateDateDiff] < 3,"1-2",
    [dateDateDiff] < 5,"3-4",
    "5+"
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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
Top Kudoed Authors