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
olimilo
Post Prodigy
Post Prodigy

Creating bins from calculated column

I created a calculated column using the following DAX:

 

Days Elapsed (Deadline) = 
	SWITCH(
		TRUE(),
		Sheet1[CompleteByEndDate] < TODAY(), ABS(-1 * DATEDIFF(Sheet1[CompleteByEndDate], TODAY(), DAY)),
		Sheet1[CompleteByEndDate] > TODAY(), DATEDIFF(TODAY(), Sheet1[CompleteByEndDate], DAY)	
	)

Now, is it possible to create bins like for the days elapsed (eg: < 7, < 14, <31, <50, >50 days elapsed)?

1 ACCEPTED SOLUTION
olimilo
Post Prodigy
Post Prodigy

Okay, I think I got it. Using this revised column for the Days Elapsed:

 

Days Elapsed (Deadline) = 
	SWITCH(
		TRUE(),
		Sheet1[CompleteByEndDate] < TODAY(), DATEDIFF(Sheet1[CompleteByEndDate], TODAY(), DAY),
		Sheet1[CompleteByEndDate] > TODAY(), -1 * DATEDIFF(TODAY(), Sheet1[CompleteByEndDate], DAY)
	)

I used this statement to make the bins and remove the Blanks (not late) in the Vis-level filter:

 

Bins = 
	SWITCH(
		TRUE(),
		Sheet1[Days Elapsed (Deadline)] >= 1 && Sheet1[Days Elapsed (Deadline)] <= 7, "A",
		Sheet1[Days Elapsed (Deadline)] >= 8 && Sheet1[Days Elapsed (Deadline)] <= 14, "B",
		Sheet1[Days Elapsed (Deadline)] >= 15 && Sheet1[Days Elapsed (Deadline)] <= 21, "C",
		Sheet1[Days Elapsed (Deadline)] > 22, "D"
	)

View solution in original post

1 REPLY 1
olimilo
Post Prodigy
Post Prodigy

Okay, I think I got it. Using this revised column for the Days Elapsed:

 

Days Elapsed (Deadline) = 
	SWITCH(
		TRUE(),
		Sheet1[CompleteByEndDate] < TODAY(), DATEDIFF(Sheet1[CompleteByEndDate], TODAY(), DAY),
		Sheet1[CompleteByEndDate] > TODAY(), -1 * DATEDIFF(TODAY(), Sheet1[CompleteByEndDate], DAY)
	)

I used this statement to make the bins and remove the Blanks (not late) in the Vis-level filter:

 

Bins = 
	SWITCH(
		TRUE(),
		Sheet1[Days Elapsed (Deadline)] >= 1 && Sheet1[Days Elapsed (Deadline)] <= 7, "A",
		Sheet1[Days Elapsed (Deadline)] >= 8 && Sheet1[Days Elapsed (Deadline)] <= 14, "B",
		Sheet1[Days Elapsed (Deadline)] >= 15 && Sheet1[Days Elapsed (Deadline)] <= 21, "C",
		Sheet1[Days Elapsed (Deadline)] > 22, "D"
	)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.