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
FoolzRailer
Helper I
Helper I

Group data in intervals

Hello 

I have a column containing the depth of several nodes, which I would like to group in intervals in a report. Is this possible or do I need to do some DAX calculation first? 

 

Basically as shown below, so the report should only show that on the right hand side. 

 

Depthinterval.png

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@FoolzRailer , Create a new column like

Switch(true(),
[Depth] <=1 , " 0-1",
[Depth] <=2, " 1-2",
[Depth] <=3 , "2-3"
)

 

and then take sum "number of" or count of "number of" in the visual with this new column

View solution in original post

@amitchandak 

 

Perfect, if I have empty values it is currently added to the interval 0-1, how do I make it so the blank/empty cells are also empty/blank in the new Interval Column? 

 

Edit: 

Figured out the Blank handling. 

 

DybdeInterval = Switch(true();
Knude[Dybde] = Blank(); Blank();
Knude[Dybde] <1 ; "0-1";
Knude[Dybde] <2; "1-2";
Knude[Dybde] ❤️ ; "2-3")
 
How do I make sure it doesn't count negative values? Right now Negative values are counted in 0-1 group, can you have two different conditions in a group?
 
Edit 2:
Think I figured out how to handle negative values, let me know if my syntax is wrong. 
 
DybdeInterval = Switch(true();
Knude[Dybde] = Blank(); Blank();
Knude[Dybde] >0 && Knude[Dybde] < 1; "0-1";
Knude[Dybde] >0 && Knude[Dybde] <2; "1-2";
Knude[Dybde] >0 && Knude[Dybde] < 3 ; "2-3";
Knude[Dybde] >0 && Knude[Dybde] <4 ; "3-4")

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@FoolzRailer , Create a new column like

Switch(true(),
[Depth] <=1 , " 0-1",
[Depth] <=2, " 1-2",
[Depth] <=3 , "2-3"
)

 

and then take sum "number of" or count of "number of" in the visual with this new column

@amitchandak 

 

Perfect, if I have empty values it is currently added to the interval 0-1, how do I make it so the blank/empty cells are also empty/blank in the new Interval Column? 

 

Edit: 

Figured out the Blank handling. 

 

DybdeInterval = Switch(true();
Knude[Dybde] = Blank(); Blank();
Knude[Dybde] <1 ; "0-1";
Knude[Dybde] <2; "1-2";
Knude[Dybde] ❤️ ; "2-3")
 
How do I make sure it doesn't count negative values? Right now Negative values are counted in 0-1 group, can you have two different conditions in a group?
 
Edit 2:
Think I figured out how to handle negative values, let me know if my syntax is wrong. 
 
DybdeInterval = Switch(true();
Knude[Dybde] = Blank(); Blank();
Knude[Dybde] >0 && Knude[Dybde] < 1; "0-1";
Knude[Dybde] >0 && Knude[Dybde] <2; "1-2";
Knude[Dybde] >0 && Knude[Dybde] < 3 ; "2-3";
Knude[Dybde] >0 && Knude[Dybde] <4 ; "3-4")

@FoolzRailer , Thanks for posting the solution finally worked. Sorry I saw this late. Marking your replay as a solution too. 

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.