Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Creating Buckets based on a percentage from measure

I have a matrix setup that shows a bunch of different job information (see screenshot below):

One of the columns (which is a measure named [%hours]) calculates the percentage of how many hours actually worked compared to the estimated hours for the job. 

For the sake of this posting I made a small example set:

 

What I want to do is create buckets for the following protocols:

Jobs 0 hrs to 75% hours,

Jobs > 75% hours and < 90% hours,

Job >= 90% hours and < 100% hours,

Jobs >= 100% hours

I then use these buckets to break the matrix down to look like below (where you can drill down on the % description to show the remaining matrix data):

 

Any suggestions would be great!

 

4 Replies

  • For your small example set, you can just add a calculated column like

    Bucket =
    SWITCH (
        TRUE (),
        [% of Hours] < 0.75, "Jobs 0 hrs to 75% hours",
        [% of Hours] < 0.90, "Jobs > 75% hours",
        [% of Hours] < 1.00, "Jobs > 90% hours",
        [% of Hours] >= 1.0, "Jobs >= 100% hours"
    )

     

    If your data is more complex, you might need to use more robust static or dynamic segmentation patterns.

    https://www.daxpatterns.com/static-segmentation/

    https://www.daxpatterns.com/dynamic-segmentation/

    • Anonymous's avatar
      Anonymous
      Not applicable

      What I forgot to mention was that [% of hours] is a measure that divides the "Actual Hours" (from Table A) by "Estimated Hours" (from Table B). So I can't necesarily create a calculated column because it references two tables?

      • AlexisOlson's avatar
        AlexisOlson
        Icon for Super User rankSuper User

        A calculated column can reference other tables. The main limitation with calculated columns is that they cannot be responsive to slicers. So if you expect the buckets to be dynamic, then you need to take a look at dynamic segmentation.