DAX Multi Level Segmentation

potap

New Member
Joined
Sep 5, 2014
Messages
43
Hi!

I am trying to get the right segment in a caculated column using this pattern :

Static Segmentation – Dax Patterns

My problem is that my ranges are not the same for every type of vehicules.

Unit
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]UnitNum[/TD]
[TD]Type[/TD]
[TD]Age[/TD]
[TD]Segment[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Pickup[/TD]
[TD]2[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Pickup[/TD]
[TD]6[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Truck[/TD]
[TD]12[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]Truck[/TD]
[TD]8[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]Pickup[/TD]
[TD]1[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]Truck[/TD]
[TD]1[/TD]
[TD]?[/TD]
[/TR]
</tbody>[/TABLE]

Segment
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Type[/TD]
[TD]Segment[/TD]
[TD]Min Age[/TD]
[TD]Max Age[/TD]
[/TR]
[TR]
[TD]Pickup[/TD]
[TD]New[/TD]
[TD]0[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Truck[/TD]
[TD]New[/TD]
[TD]0[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Pickup[/TD]
[TD]Middle[/TD]
[TD]2[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Truck[/TD]
[TD]Middle[/TD]
[TD]3[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]Pickup[/TD]
[TD]End[/TD]
[TD]4[/TD]
[TD]9999[/TD]
[/TR]
[TR]
[TD]Truck[/TD]
[TD]End[/TD]
[TD]9[/TD]
[TD]9999[/TD]
[/TR]
</tbody>[/TABLE]

Thank you!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Just add checking of Type to the formula

=CALCULATE (
VALUES ( Segment[Segment] ),
FILTER (Segment,
Unit[Age] >= Segment[Min Age]
&& Unit[Age] < Segment[Max Age] && Segment[Type] = Unit[Type]))
 
Upvote 0

Forum statistics

Threads
1,224,096
Messages
6,176,325
Members
452,721
Latest member
Du Toit

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top