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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
NDDD
Helper I
Helper I

Grouping measure days delta with new measure by group of days

Good day, 

 

 I use live connection and some functions are limited. Now I have measure providing the delta between Shipped and Entry date. Now will need measure to group the delta in range of days 1-7, 8-14, 14-21, Over 21.

Exs in excel where Groups are present 

NDDD_0-1651059134857.png

 

Thanks 

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@NDDD I think I see the issue. Try this:

 

Groups_Measure = 
VAR _delta = [Delta Ship-Entry]
RETURN
IF(
NOT ISBLANK(_delta),
SWITCH(
	TRUE(),
	_delta <= 7, "1-7",
	_delta <= 14, "8-14",
	"15-21"
))

 

View solution in original post

7 REPLIES 7
NDDD
Helper I
Helper I

@SpartaBI 

Thanks for the prompt reply, this solution didn't work. Power Bi keeps loading the newly measure 

SpartaBI
Community Champion
Community Champion

@NDDD very strange.

Can you send screeshots from your Power BI. Where did you put that measure. What is table in the model and in case you created a table visual, also that.

@SpartaBI  It seems the problem is when adding a column for another table. Then, as in my previous message we see blanks and one group of 1-7. 

@SpartaBI seems when using first measure (calculating the delta Ship - Entry) along the new Group measure (as you suggested) is having error. 

NDDD_0-1651071828251.png

But when I use slicer is showing correct output 

NDDD_1-1651071874475.png

 

SpartaBI
Community Champion
Community Champion

@NDDD I think I see the issue. Try this:

 

Groups_Measure = 
VAR _delta = [Delta Ship-Entry]
RETURN
IF(
NOT ISBLANK(_delta),
SWITCH(
	TRUE(),
	_delta <= 7, "1-7",
	_delta <= 14, "8-14",
	"15-21"
))

 

@SpartaBI This worked!!! Thank you

SpartaBI
Community Champion
Community Champion

@NDDD 

Groups_Measure = 
VAR _delta = [Delta Ship-Entry]
RETURN
SWITCH(
	TRUE(),
	_delta <= 7, "1-7",
	_delta <= 14, "8-14",
	"15-21"
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.